Reviewed: https://review.openstack.org/352190 Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=b0aa83aca39bc268e2ad82019ac16c4e9499662e Submitter: Jenkins Branch: master
commit b0aa83aca39bc268e2ad82019ac16c4e9499662e Author: hobo.kengo <[email protected]> Date: Mon Aug 8 02:23:54 2016 +0000 Add string validation on security group's name This patch disallows cases that following name is specified. 1. name whose type is not String. 2. name whose characters is more than 255. Change-Id: Ib72a4e480b62a22da2171ed24449321f2b27258b Closes-Bug: #1610764 ** Changed in: neutron Status: In Progress => Fix Released -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to neutron. https://bugs.launchpad.net/bugs/1610764 Title: Create/Update security-group returns 500 error when boolean is specified as name. Status in neutron: Fix Released Bug description: Currently, only validation for name of security-group is, specified name is "default" or not. Thus, following case will fail with 500 error. 1. name whose type is not String. 2. name whose characters is more than 255. request(case 1.) ======================= ubuntu@neutron-ml2:/opt/stack/neutron$ curl -g -i -X POST http://172.16.1.29:9696/v2.0/security-groups -H "X-Auth-Token: $TOKEN" -d '{"security_group":{"name":true}}' HTTP/1.1 500 Internal Server Error Content-Type: application/json Content-Length: 150 X-Openstack-Request-Id: req-14b8c0ee-8cd9-40a4-b297-a38bc2ce21ba Date: Mon, 08 Aug 2016 01:28:13 GMT {"NeutronError": {"message": "Request Failed: internal server error while processing your request.", "type": "HTTPInternalServerError", "detail": ""}} ======================== trace in neutron-server(case 1.) ======================== 2016-08-08 01:28:13.215 10345 ERROR neutron.api.v2.resource [req-14b8c0ee-8cd9-40a4-b297-a38bc2ce21ba b3ec23ec52144d7e96696abef028a5b0 7dbb594bc59546f6b26ad73da253c90a - - -] create failed: No details. 2016-08-08 01:28:13.215 10345 ERROR neutron.api.v2.resource Traceback (most recent call last): 2016-08-08 01:28:13.215 10345 ERROR neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/resource.py", line 79, in resource 2016-08-08 01:28:13.215 10345 ERROR neutron.api.v2.resource result = method(request=request, **args) 2016-08-08 01:28:13.215 10345 ERROR neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/base.py", line 397, in create 2016-08-08 01:28:13.215 10345 ERROR neutron.api.v2.resource return self._create(request, body, **kwargs) 2016-08-08 01:28:13.215 10345 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 148, in wrapper 2016-08-08 01:28:13.215 10345 ERROR neutron.api.v2.resource ectxt.value = e.inner_exc 2016-08-08 01:28:13.215 10345 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__ 2016-08-08 01:28:13.215 10345 ERROR neutron.api.v2.resource self.force_reraise() 2016-08-08 01:28:13.215 10345 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise 2016-08-08 01:28:13.215 10345 ERROR neutron.api.v2.resource six.reraise(self.type_, self.value, self.tb) 2016-08-08 01:28:13.215 10345 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 138, in wrapper 2016-08-08 01:28:13.215 10345 ERROR neutron.api.v2.resource return f(*args, **kwargs) 2016-08-08 01:28:13.215 10345 ERROR neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/base.py", line 406, in _create 2016-08-08 01:28:13.215 10345 ERROR neutron.api.v2.resource allow_bulk=self._allow_bulk) 2016-08-08 01:28:13.215 10345 ERROR neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/base.py", line 684, in prepare_request_body 2016-08-08 01:28:13.215 10345 ERROR neutron.api.v2.resource attributes.convert_value(attr_info, res_dict, webob.exc.HTTPBadRequest) 2016-08-08 01:28:13.215 10345 ERROR neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/attributes.py", line 434, in convert_value 2016-08-08 01:28:13.215 10345 ERROR neutron.api.v2.resource attr_vals['validate'][rule]) 2016-08-08 01:28:13.215 10345 ERROR neutron.api.v2.resource File "/opt/stack/neutron/neutron/extensions/securitygroup.py", line 210, in _validate_name_not_default 2016-08-08 01:28:13.215 10345 ERROR neutron.api.v2.resource if data.lower() == "default": 2016-08-08 01:28:13.215 10345 ERROR neutron.api.v2.resource AttributeError: 'bool' object has no attribute 'lower' 2016-08-08 01:28:13.215 10345 ERROR neutron.api.v2.resource =========================== To manage notifications about this bug go to: https://bugs.launchpad.net/neutron/+bug/1610764/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

