GET server API does not handle invalid sort keys or directions gracefully

Bug #1403230 reported by Steven Kaufer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Steven Kaufer

Bug Description

If an invalid sort key or sort direction is given the REST API returns an error code 500 with the "The server has either erred or is incapable of performing the requested operation." message.

This is occurring because the exceptions raised in oslo.db.sqlalchemy.utils.paginate_query are not caught and handled in nova.

Exception raised here:
https://github.com/openstack/oslo.db/blob/master/oslo/db/sqlalchemy/utils.py#L147
https://github.com/openstack/oslo.db/blob/master/oslo/db/sqlalchemy/utils.py#L152

The error raised in this scenario should be more specific.

Steven Kaufer (kaufer)
Changed in nova:
assignee: nobody → Steven Kaufer (kaufer)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

Changed in nova:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/142247
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=c6d82c0ac25ddeed4e06f1d79d1128e915dafb74
Submitter: Jenkins
Branch: master

commit c6d82c0ac25ddeed4e06f1d79d1128e915dafb74
Author: Steven Kaufer <email address hidden>
Date: Tue Dec 16 22:39:04 2014 +0000

    Handle invalid sort keys/dirs gracefully

    If an invalid sort key or sort direction is supplied on a GET servers
    REST API call, the API returns an error code 500 with the "The server
    has either erred or is incapable of performing the requested
    operation." message.

    This is occurring because the exceptions raised in
    oslo.db.sqlalchemy.utils.paginate_query are not caught and handled in
    nova.

    paginate_query raises oslo.db.exception.InvalidSortKey for an invalid
    sort key and raises a ValueError for an invalid sort direction.

    Change-Id: I42ceaa461ddbf33dde44355d0cb0fb752c361f2f
    Closes-Bug: 1403230

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → kilo-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: kilo-1 → 2015.1.0
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.