security group does not verify the tenant id
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
neutron |
Confirmed
|
High
|
Unassigned |
Bug Description
how to reproduce the problem:
1.source admin-openrc
2.list security groups with tenant_id, tenant_id does not actually exist
curl -g -i -X GET http://
3.query the security group in the database
MariaDB [neutron]> select * from securitygroups where project_
+------
| project_id | id | name | standard_attr_id | stateful |
+------
| 99977aaf8d7a466
+------
Changed in neutron: | |
assignee: | nobody → zhanghao (zhanghao2) |
While I'm not sure what exactly you considered to be the error, it seems to me there are multiple problems around here:
source openrc demo demo ; export TOKEN="$( openstack token issue -f value -c id )"
curl -s -H "Content-Type: application/json" -H "X-Auth-Token: $TOKEN" -X GET http:// 127.0.0. 1:9696/ v2.0/security- groups
works as expected
curl -s -H "Content-Type: application/json" -H "X-Auth-Token: $TOKEN" -X GET http:// 127.0.0. 1:9696/ v2.0/security- groups? tenant_ id=$( openstack project show demo -f value -c id )
works as expected
curl -s -H "Content-Type: application/json" -H "X-Auth-Token: $TOKEN" -X GET http:// 127.0.0. 1:9696/ v2.0/security- groups? tenant_ id=foobar
no response, client hangs
curl -s -H "Content-Type: application/json" -H "X-Auth-Token: $TOKEN" -X GET http:// 127.0.0. 1:9696/ v2.0/security- groups? tenant_ id=$( uuid | tr -d - )
internal server error
source openrc admin admin ; export TOKEN="$( openstack token issue -f value -c id )"
curl -s -H "Content-Type: application/json" -H "X-Auth-Token: $TOKEN" -X GET http:// 127.0.0. 1:9696/ v2.0/security- groups
works as expected
curl -s -H "Content-Type: application/json" -H "X-Auth-Token: $TOKEN" -X GET http:// 127.0.0. 1:9696/ v2.0/security- groups? tenant_ id=$( openstack project show admin -f value -c id )
works as expected
curl -s -H "Content-Type: application/json" -H "X-Auth-Token: $TOKEN" -X GET http:// 127.0.0. 1:9696/ v2.0/security- groups? tenant_ id=foobar
echoes foobar in the response
curl -s -H "Content-Type: application/json" -H "X-Auth-Token: $TOKEN" -X GET http:// 127.0.0. 1:9696/ v2.0/security- groups? tenant_ id=$( uuid | tr -d - )
echoes the random uuid in the response
I would say the 1) no response, 2) internal server error and 3) unvalidated echo cases are all bugs.
neutron server log for the no response case:
jan 22 15:13:06 devstack0 neutron- server[ 342671] : DEBUG neutron_lib.db.api [None req-f63b9ee0- bb5c-4e19- 9150-3e0dd18a01 b7 demo demo] Retry wrapper got retriable exception: Failed to create a duplicate DefaultSecurity Group: for attribute(s) ['default_ security_ group.PRIMARY' ] with value(s) foobar {{(pid=342671) wrapped /opt/stack/ neutron- lib/neutron_ lib/db/ api.py: 183}}
neutron server log for the internal server error:
jan 22 15:15:25 devstack0 neutron- server[ 342672] : ERROR neutron. api.v2. resource [None req-160228f5- d91d-4fc3- 81a1-729056507e 49 demo demo] index failed: No details.: TypeError: 'NoneType' object is not subscriptable server[ 342672] : ERROR neutron. api.v2. resource Traceback (most recent call last): server[ 342672] : ERROR neutron. api.v2. resource File "/opt/stack/ neutron/ neutron/ api/v2/ resource. py", line 98, in resource server[ 342672] : ERROR neutron. api.v2. resource result = method( request= request, **args) server[ 342672] : ERROR neutron. api.v2. resource File "/opt/stack/ neutron- lib/neutron_ lib/db/ api.py" , line 139, in wrapped server[ 342672] : ERROR neutron. api.v2. resource setattr(e, '_RETRY_EXCEEDED', True) server[ 342672] : ERROR neutron. api.v2. resource F...
jan 22 15:15:25 devstack0 neutron-
jan 22 15:15:25 devstack0 neutron-
jan 22 15:15:25 devstack0 neutron-
jan 22 15:15:25 devstack0 neutron-
jan 22 15:15:25 devstack0 neutron-
jan 22 15:15:25 devstack0 neutron-