Neutron should verify attributes inside a dict

Bug #1535626 reported by Bo Chi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Low
Unassigned
python-neutronclient
Invalid
Undecided
Unassigned

Bug Description

Currently Neutron did not verify the attributes inside a dict, for exp:

If following body is send to neutron server for router-update, no error will show
'{"router": {"external_gateway_info": {"network_id": "b92781fe-2d31-49a6-b648-98d937faf0b8", "wrong": true}}}'
There's a wrong attribute in which is named "wrong"

while the correct body is
'{"router": {"external_gateway_info": {"network_id": "b92781fe-2d31-49a6-b648-98d937faf0b8", "external_fixed_ips": [{"subnet-id": "7ebd8fc9-def1-47f1-97e0-e28c51dc591c"}]}}}'

The solution is to add verify_attributes(data, key_specs) in _validate_dict()

Tags: api
Bo Chi (bochi-michael)
Changed in python-neutronclient:
assignee: nobody → Bo Chi (bochi-michael)
Revision history for this message
Armando Migliaccio (armando-migliaccio) wrote :
Changed in python-neutronclient:
status: New → Confirmed
importance: Undecided → Low
status: Confirmed → Invalid
Changed in neutron:
status: New → Invalid
Changed in python-neutronclient:
assignee: Bo Chi (bochi-michael) → nobody
Changed in neutron:
assignee: nobody → Bo Chi (bochi-michael)
importance: Undecided → Low
Changed in python-neutronclient:
importance: Low → Undecided
Changed in neutron:
status: Invalid → Confirmed
Kapil (kapiljain1989)
Changed in python-neutronclient:
assignee: nobody → Kapil (kapiljain1989)
Changed in python-neutronclient:
assignee: Kapil (kapiljain1989) → nobody
Changed in neutron:
assignee: Bo Chi (bochi-michael) → nobody
tags: added: api
Revision history for this message
Rohan Arora (ra271w) wrote :

Should this bug be closed? After reading through https://review.openstack.org/#/c/269540/, it seems like the function _verify_dict_keys() currently located in neutron-lib/api/validators.py solves the issue described.

Changed in neutron:
status: Confirmed → Fix Released
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.