v1: sending bad format to created_at/deleted_at returns 500

Bug #1483649 reported by Stuart McLaren
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Undecided
Niall Bunting

Bug Description

> POST /v1/images HTTP/1.1
> User-Agent: curl/7.35.0
> Host: localhost:9292
> Accept: */*
> x-auth-token: 730b8eabc2e34a1299fcafa888131dc5
> x-image-meta-disk-format: raw
> x-image-meta-container-format: bare
> Content-type: application/octet-stream
> x-image-meta-updated_at: foo
> Content-Length: 2
>
* upload completely sent off: 2 out of 2 bytes
< HTTP/1.1 500 Internal Server Error
< Content-Type: text/plain
< Content-Length: 0
< Date: Tue, 11 Aug 2015 10:50:59 GMT
< Connection: close

* Closing connection 0
* Hostname was NOT found in DNS cache
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 9292 (#0)
> POST /v1/images HTTP/1.1
> User-Agent: curl/7.35.0
> Host: localhost:9292
> Accept: */*
> x-auth-token: 730b8eabc2e34a1299fcafa888131dc5
> x-image-meta-disk-format: raw
> x-image-meta-container-format: bare
> Content-type: application/octet-stream
> x-image-meta-deleted_at: foo
> Content-Length: 2
>
* upload completely sent off: 2 out of 2 bytes
< HTTP/1.1 500 Internal Server Error
< Content-Type: text/plain
< Content-Length: 0
< Date: Tue, 11 Aug 2015 10:53:38 GMT
< Connection: close

Changed in glance:
assignee: nobody → Niall Bunting (niall-bunting)
status: New → Confirmed
Revision history for this message
Niall Bunting (niall-bunting) wrote :

I thought that making these forbidden for V1 would be to much of an api change, as someone may be using these
values as it returns a 200 when they work.

I could not work out a way to validate this as the different databases will accept different values. And depending
on what people are using as a database this could be too limiting. This lead to catching the error, that is a pretty
general database error. So it my patch it will catch that error and look for the value datetime.

This however is a very hacky way of doing things. Therefore maybe someone else will come up with a better solution.

Changed in glance:
assignee: Niall Bunting (niall-bunting) → nobody
Revision history for this message
Niall Bunting (niall-bunting) wrote :
Revision history for this message
Niall Bunting (niall-bunting) wrote :

On reflection, it would be better to check if the time conforms to the iso standard.

Changed in glance:
assignee: nobody → Niall Bunting (niall-bunting)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

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

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

Reviewed: https://review.openstack.org/248180
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=4c486d470d064493f420fa0b0c278833d73a3567
Submitter: Jenkins
Branch: master

commit 4c486d470d064493f420fa0b0c278833d73a3567
Author: NiallBunting <email address hidden>
Date: Fri Nov 20 17:05:48 2015 +0000

    V1: Fix bad dates returning 500

    Currently if you send a bad date format such as 'foo', as one of the
    settable dates ie. `created_at`, `updated_at` and `deleted_at` it will
    cause the server to return a 500.

    This change means that the server will respond with a 400 and a helpful
    message.

    Change-Id: Ib342ef6640efbc3d76c4bafc622ccfdfa3d16ade
    Closes-Bug: 1483649

Changed in glance:
status: In Progress → Fix Committed
Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/glance 12.0.0.0b1

This issue was fixed in the openstack/glance 12.0.0.0b1 development milestone.

Changed in glance:
status: Fix Committed → 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.