Non-existent properties in POST are ignored for all the resources

Bug #1277571 reported by Max Lobur
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ironic
Fix Released
Low
Unassigned
WSME
Fix Released
Undecided
Stéphane Bisinger

Bug Description

tempest.common.rest_client: INFO: Request: POST http://192.168.122.224:6385/v1/chassis
tempest.common.rest_client: DEBUG: Request Headers: {'Content-Type': 'application/json', 'Accept': 'application/json', 'X-Auth-Token': '<Token omitted>'}

tempest.common.rest_client: DEBUG: Request Body: {"description": "test1", "nonexistent": "abcd"}
tempest.common.rest_client: INFO: Response Status: 201
tempest.common.rest_client: DEBUG: Response Headers: {'date': 'Fri, 07 Feb 2014 15:54:47 GMT', 'content-length': '610', 'content-type': 'application/json; charset=UTF-8', 'server': 'WSGIServer/0.1 Python/2.7.3'}
tempest.common.rest_client: DEBUG: Response Body: {
"description": "test1",
"links":
[{"href": "http://192.168.122.224:6385/v1/chassis/b84fd02e-d1be-44cb-bf18-fad321c70c81", "rel": "self"},
{"href": "http://192.168.122.224:6385/v1/chassis/b84fd02e-d1be-44cb-bf18-fad321c70c81", "rel": "bookmark"}],
"extra": {},
"created_at": "2014-02-07T15:54:47.296054+00:00",
"updated_at": null,
"nodes": [{"href": "http://192.168.122.224:6385/v1/chassis/b84fd02e-d1be-44cb-bf18-fad321c70c81/nodes", "rel": "self"},
{"href": "http://192.168.122.224:6385/chassis/b84fd02e-d1be-44cb-bf18-fad321c70c81/nodes", "rel": "bookmark"}],
"uuid": "b84fd02e-d1be-44cb-bf18-fad321c70c81"}

Chassis created ignoring nonexistent property. But it should have been failed with 400 code.

Changed in ironic:
assignee: nobody → Ramakrishnan G (rameshg87)
Changed in ironic:
status: Triaged → In Progress
Revision history for this message
Ramakrishnan G (rameshg87) (rameshg87) wrote :

I cannot find anyway to handle this in ironic. wsme/pecan takes care of coverting the JSON data passed to the model object and ironic doesn't even get to see the non-existent properties passed. Shouldn't this be something that is configurable in wsme to throw HTTP 400 error code in case if non-existent fields are passed as POST request to the controller ?

Revision history for this message
Dmitry Tantsur (divius) wrote :

Hi!

Ramakrishnan G, judging by your comment, you're not working at the moment on this issue, so I'll clear it's status and assignee. If I'm wrong, please feel free to reassign yourself.

Max, I suspect this is behaviour imposed by WSME, so I link it here.

Changed in ironic:
status: In Progress → Confirmed
assignee: Ramakrishnan G (rameshg87) → nobody
importance: Medium → Low
Revision history for this message
Max Lobur (max-lobur) wrote :

Yea, as per rameshg87 comment this should be fixed in WSME, thanks!

Changed in wsme:
assignee: nobody → Stéphane Bisinger (kjir)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to wsme (master)

Reviewed: https://review.openstack.org/182761
Committed: https://git.openstack.org/cgit/stackforge/wsme/commit/?id=6461c1b8a1dcb8820eeb32bbfbe8e3f22b3fa7ce
Submitter: Jenkins
Branch: master

commit 6461c1b8a1dcb8820eeb32bbfbe8e3f22b3fa7ce
Author: Stéphane Bisinger <email address hidden>
Date: Wed May 13 19:08:56 2015 +0200

    Complex types should check unexpected attributes

    Check if a request is passing more attributes for complex objects than
    those defined in the API. WSME did not care if some unknown attribute
    was passed to an API with a complex type, only checking the required
    attributes. This is fixed raising a ValueError if more attributes are
    given than expected, resulting in an HTTP response with a 400 status.
    This helps check the validity of requests, which would otherwise
    unexpectedly work with (partially) invalid data.

    Closes-Bug: #1277571
    Change-Id: Idf720a1c3fac8bdc8dca21a1ccdb126110dae62e

Changed in wsme:
status: In Progress → Fix Committed
Changed in wsme:
milestone: none → 0.8.0
status: Fix Committed → Fix Released
Revision history for this message
Pavlo Shchelokovskyy (pshchelo) wrote :

AFAIU this can be marked as invalid in Ironic when global requirements will bump WSME version to >=0.8.0, and synced back to Ironic

Revision history for this message
Zhenguo Niu (niu-zglinux) wrote :

https://review.openstack.org/#/c/238430/ to bump WSME verstion to >= 0.8

Revision history for this message
Ruby Loo (rloo) wrote :

This was fixed awhile ago.

Confirmed today (these are snippets):

POST http://10.0.2.15:6385/v1/chassis -H "X-OpenStack-Ironic-API-Version: 1.9" -H ...
-d '{"nonexist": "test"}'

RESP: [400] X-Openstack-Ironic-Api-Minimum-Version: 1.1 X-Openstack-Ironic-Api-Maximum-Version: 1.22 X-Openstack-Ironic-Api-Version: 1.9 Openstack-Request-Id: req-707c91a1-28ca-4a15-8866-051bf27d9089 Content-Type: application/json Content-Length: 140 Date: Wed, 14 Sep 2016 14:09:11 GMT Connection: keep-alive
RESP BODY: {"error_message": "{\"debuginfo\": null, \"faultcode\": \"Client\", \"faultstring\": \"Unknown attribute for argument chassis: nonexist\"}"}

Changed in ironic:
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.