Create/Update security-group returns 500 error when boolean is specified as name.

Bug #1610764 reported by Kengo Hobo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Low
Miguel Lavalle

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
===========================

Kengo Hobo (hobo-kengo)
Changed in neutron:
assignee: nobody → Kengo Hobo (hobo-kengo)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/352190

Changed in neutron:
status: New → In Progress
Changed in neutron:
importance: Undecided → Low
Changed in neutron:
assignee: Kengo Hobo (hobo-kengo) → Kevin Benton (kevinbenton)
Changed in neutron:
assignee: Kevin Benton (kevinbenton) → Reedip (reedip-banerjee)
Changed in neutron:
assignee: Reedip (reedip-banerjee) → Miguel Lavalle (minsel)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

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 address hidden>
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
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 11.0.0.0b2

This issue was fixed in the openstack/neutron 11.0.0.0b2 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.