unreasonable error message returned when an empty body was posted to POST request

Bug #1455298 reported by Liusheng
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Won't Fix
Low
Kent Wang

Bug Description

For now, if a POST request with an empty body, the bad request message will return a code-level error info, this is unfriendly to end users.

The curl request of a POST request with a empty body:

curl -g -i --cacert "/opt/stack/data/CA/int-ca/ca-chain.pem" -X POST http://10.250.10.15:35357/v2.0/users -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: b648b3deb12d4f3bb114a303eb153507" -d '{}'

the return message:

{"error": {"message": "create_user() takes exactly 3 arguments (2 given)", "code": 400, "title": "Bad Request"}}

The others keystone API has the same issue.

the reasonable return of a this type request is like this:

curl -g -i --cacert "/opt/stack/data/CA/int-ca/ca-chain.pem" -X POST http://10.250.10.15:8776/v2/30be1fc9a03c4e94ab05c403a8a377f2/volumes -H "User-Agent: python-cinderclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: b648b3deb12d4f3bb114a303eb153507" -d '{}'

{"badRequest": {"message": "Missing required element 'volume' in request body", "code": 400}}

Liusheng (liusheng)
Changed in keystone:
assignee: nobody → Liusheng (liusheng)
Dolph Mathews (dolph)
tags: added: user-experience
Changed in keystone:
status: New → Triaged
importance: Undecided → Low
Liusheng (liusheng)
Changed in keystone:
assignee: Liusheng (liusheng) → nobody
Kent Wang (k.wang)
Changed in keystone:
assignee: nobody → Kent Wang (k.wang)
Revision history for this message
Dave Chen (wei-d-chen) wrote :

We have schema validation for v3 API, but don't apply the schema validation to v2 API, consider that v2 API has been deprecated there might be no such urgent requirement to enforce schema validation to v2 API.

In my point of view, this is a generic issue for v2 api instead of user specific.

So, either check the argument within each API or enforce schema validation to v2 API.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (master)

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

Changed in keystone:
status: Triaged → In Progress
tags: added: validation
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on keystone (master)

Change abandoned by Morgan Fainberg (<email address hidden>) on branch: master
Review: https://review.openstack.org/238160
Reason: administrativly abandoning this patch as it's targeting V2 specifically which is deprecated. the bug will likewise be marked as "wont fix"

Revision history for this message
Morgan Fainberg (mdrnstm) wrote :

V2 is deprecated, we aren't really looking to provide significant improvements. The end goal will be to move everyone to v3 which has proper validation.

Changed in keystone:
status: In Progress → 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.