POST /os-security-groups returns HTTP 500 on invalid input

Bug #1953734 reported by Balazs Gibizer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Won't Fix
Undecided
Unassigned

Bug Description

Nova does not validate the input on os-security-groups API resource.

curl -X POST 'http://10.1.0.21/compute/v2.1/os-security-groups' -d '{"security_group": "nostrud commodo tempor", "name": "eiusmod veniam", "description": "non esse occaecat"}' -H "Content-Type: application/json; charset=UTF-8" -H "Accept: application/json" -H "X-Auth-Token: ${token}"
{"computeFault": {"code": 500, "message": "Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.\n<class 'AttributeError'>"}}

Dec 09 10:27:16 master0 <email address hidden>[3644655]: ERROR nova.api.openstack.wsgi [None req-910489b0-9e02-4748-84ed-f2b2574ec7bb admin admin] Unexpected exception in API method: Attribut>
Dec 09 10:27:16 master0 <email address hidden>[3644655]: ERROR nova.api.openstack.wsgi Traceback (most recent call last):
Dec 09 10:27:16 master0 <email address hidden>[3644655]: ERROR nova.api.openstack.wsgi File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 658, in wrapped
Dec 09 10:27:16 master0 <email address hidden>[3644655]: ERROR nova.api.openstack.wsgi return f(*args, **kwargs)
Dec 09 10:27:16 master0 <email address hidden>[3644655]: ERROR nova.api.openstack.wsgi File "/opt/stack/nova/nova/api/openstack/compute/security_groups.py", line 219, in create
Dec 09 10:27:16 master0 <email address hidden>[3644655]: ERROR nova.api.openstack.wsgi group_name = security_group.get('name', None)
Dec 09 10:27:16 master0 <email address hidden>[3644655]: ERROR nova.api.openstack.wsgi AttributeError: 'str' object has no attribute 'get'
Dec 09 10:27:16 master0 <email address hidden>[3644655]: ERROR nova.api.openstack.wsgi
Dec 09 10:27:16 master0 <email address hidden>[3644655]: INFO nova.api.openstack.wsgi [None req-910489b0-9e02-4748-84ed-f2b2574ec7bb admin admin] HTTP exception thrown: Unexpected API Error. >
Dec 09 10:27:16 master0 <email address hidden>[3644655]: <class 'AttributeError'>
Dec 09 10:27:16 master0 <email address hidden>[3644655]: DEBUG nova.api.openstack.wsgi [None req-910489b0-9e02-4748-84ed-f2b2574ec7bb admin admin] Returning 500 to user: Unexpected API Error.>
Dec 09 10:27:16 master0 <email address hidden>[3644655]: <class 'AttributeError'> {{(pid=3644655) __call__ /opt/stack/nova/nova/api/openstack/wsgi.py:936}}

reproducible on recent master with simple devstack setup

tags: added: api security-groups
summary: - POST /os-security-groups returns HTTP 500 of invalid input
+ POST /os-security-groups returns HTTP 500 on invalid input
Revision history for this message
Sylvain Bauza (sylvain-bauza) wrote :

As we document in our API docs, this /os-security-groups API resource is now deprecated [1] since API microversion 2.36 [2] which is shipped with the Newton release

[1] https://docs.openstack.org/api-ref/compute/#create-security-group
[2] https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#microversion

Accordingly, we can't fix this bug in our project, even within the existing stable branches.

Changed in nova:
status: New → Won't Fix
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.