the safe xml calls, cause http 500 errors in the API, it should cause 400 (invalid request) errors instead

Bug #1133111 reported by Matthew Sherborne
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Matthew Sherborne

Bug Description

When we parse incoming XML safely, if there was an error raised it would be an expat.Expat() error, which would bubble up to the api and turn into a HTTP 500 (Internal Error)

If the incoming XML in wrong, it should return a 400 (Invalid Request) error.

Tags: api parsing xml
Changed in nova:
assignee: nobody → Matthew Sherborne (msherborne+openstack)
Changed in nova:
status: New → Confirmed
importance: Undecided → Medium
Changed in nova:
status: Confirmed → In Progress
Revision history for this message
Sean Dague (sdague) wrote :

Is there a test case that demonstrates this failure today? possibly something we can running in tempest?

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

Reviewed: https://review.openstack.org/22926
Committed: http://github.com/openstack/nova/commit/3478f1e121d84d15558d338a32315f13250cf3bb
Submitter: Jenkins
Branch: master

commit 3478f1e121d84d15558d338a32315f13250cf3bb
Author: Matthew Sherborne <email address hidden>
Date: Tue Feb 26 10:35:42 2013 +1000

    Makes safe xml data calls raise 400 http error instead of 500

    When we parse incoming XML safely, if there was an error raised it would
    be an expat.Expat() error, which would bubble up to the api and turn
    into a HTTP 500 (Internal Error)

    It turns out that all the places we use the safe_xml parsing are in
    Deserializers, close to the API, so in this patch we just change the
    error it raises straight to nova.exception.MalformedRequest().

    This causes the api to fail with the proper 400 (Malformed Request) when
    it encounters corrupt XML. This is caught at
    nova.api.openstack.wsgi._process_stack and __call__.

    We also take the opportunity to move the new safe parser from nova.utils
    to nova.api.openstack.xmlutil as the openstack api is the only thing
    that uses it.

    Fixes: bug #1133111
    Change-Id: Ifa2ed7ee128241cfe8dbcdc5bd75194d96b6cdb5

Changed in nova:
status: In Progress → Fix Committed
Revision history for this message
Matthew Sherborne (msherborne+openstack) wrote :

Nothing in tempest, only the unit tests in that commit: https://bugs.launchpad.net/nova/+bug/1155280

Revision history for this message
Matthew Sherborne (msherborne+openstack) wrote :

Sorry, I meant to say: in that commit: https://review.openstack.org/#/c/22926/

Thierry Carrez (ttx)
Changed in nova:
milestone: none → grizzly-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: grizzly-rc1 → 2013.1
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.