HTTP 500 raised by POST /shares API when failing to handle "share_type" in request

Bug #1944478 reported by Goutham Pacha Ravi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Shared File Systems Service (Manila)
Triaged
Low
Unassigned

Bug Description

Description
===========

The POST /shares API [1] does not validate the "share_type" as expected. If the request contains an object instead of a string, HTTP 500 is raised due to a DB lookup error:

Example Request:

        POST https://shared-file-systems.com/share/v2/shares
        Body: {"share": {"share_proto": "cephfs", "description": "share-desc-1579612894", "snapshot_id": null, "name": "share-1663895707", "size": 1, "metadata": {}, "is_public": false, "share_type": {"id": "9b158411-67de-4a90-9b10-92f545d4967f", "name": "type-1726987944", "extra_specs": {"driver_handles_share_servers": "False"}, "required_extra_specs": {"driver_handles_share_servers": false}, "share_type_access:is_public": true, "description": null, "is_default": false}}}

Log from the failure: https://paste.opendev.org/show/809481/

Steps to reproduce
==================

A chronological list of steps which will help reproduce the issue you hit:

* curl -i -X POST $MANILA_ENDPOINT -H "X-Auth-Token: $TOKEN" -H "Accept: application/json" -H "Content-Type: application/json" -d '{"share": {"size": 1, "share_proto": "nfs", "share_type": {"id": "9b158411-67de-4a90-9b10-92f545d4967f", "name": "type-1726987944", "extra_specs": {"driver_handles_share_servers": "False"}, "required_extra_specs": {"driver_handles_share_servers": false}, "share_type_access:is_public": true, "description": null, "is_default": false}}'

Expected result
===============

HTTP 400, BadRequest - the share_type parameter was badly formatted

Actual result
=============

HTTP 500, Internal Server Error

Environment
===========
1. dev branch of openstack/manila

[1] https://docs.openstack.org/api-ref/shared-file-system/?expanded=create-share-detail#create-share

tags: added: low-hanging-fruit
Vida Haririan (vhariria)
tags: added: api
Elena Lindqvist (eqvist)
Changed in manila:
assignee: nobody → Elena Lindqvist (eqvist)
Changed in manila:
assignee: Elena Lindqvist (eqvist) → nobody
Changed in manila:
assignee: nobody → Yuchen Zhang (yuchenz-ubuntu)
Changed in manila:
importance: Undecided → Low
Changed in manila:
assignee: Yuchen Zhang (yuchenz-ubuntu) → nobody
Changed in manila:
assignee: nobody → Goutham Pacha Ravi (gouthamr)
Changed in manila:
assignee: Goutham Pacha Ravi (gouthamr) → nobody
assignee: nobody → Shazia Parveen (sparveen)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to manila (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/manila/+/858214

Changed in manila:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/manila/+/858225

Changed in manila:
assignee: Shazia Parveen (sparveen) → nobody
status: In Progress → New
status: New → Confirmed
Changed in manila:
status: Confirmed → In Progress
Changed in manila:
status: In Progress → New
Revision history for this message
Clifford Emeka (emclidon) wrote :

Hi Goutham,

Is the bug still open so I can take it up?

Revision history for this message
Goutham Pacha Ravi (gouthamr) wrote :

> Hi Goutham,
> Is the bug still open so I can take it up?

Hey Clifford,

Yes it is. Bugs that have no asignee (see field "Assigned to") and the Status as "New" are open to claim. Thanks for asking.

Vida Haririan (vhariria)
Changed in manila:
status: New → Triaged
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.