yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #42839
[Bug 1208847] Re: Protect HasStatusDescription from bad input
[Expired for neutron because there has been no activity for 60 days.]
** Changed in: neutron
Status: Incomplete => Expired
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1208847
Title:
Protect HasStatusDescription from bad input
Status in neutron:
Expired
Bug description:
This model class holds two fields:
1) status - across the code this fields is basiclly used as enum . The suggested fix tries to keep this behaviour.
2) status_description - lbaas drivers code may try to push here long stack traces (espaecially when we are in ERROR state..). This fix adds protection to the description field.
Note: I have added the status validation to a lbaas specific class
because I am not sure all extended services share the same status
fields.
class HasStatusDescription(object):
"""Status with description mixin."""
status = sa.Column(sa.String(16), nullable=False)
status_description = sa.Column(sa.String(255))
@validates('status_description')
'''Make sure we dont try to insert long string.'''
def trancate(self, key, value):
return value[:254]
class LBaaSHasStatusDescription(HasStatusDescription):
VALID_STATUS_SET = (constants.ACTIVE,constants.PENDING_CREATE,constants.PENDING_UPDATE,
constants.PENDING_DELETE,constants.INACTIVE,constants.ERROR)
@validates('status')
'''Make sure that the status belongs to a closed set.'''
def validate_status(self, key, value):
if value not in VALID_STATUS_SET:
data = {'key': key,
'value': value,
'valid_values': VALID_STATUS_SET}
raise ValueError(_('The %(key)s field can not have '
'the value %(value)s. '
'Valid values are %(valid_values)s.') % data)
return value
To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1208847/+subscriptions