'500' can occur when inaccessible id of other user used as marker

Bug #1178307 reported by Stuart McLaren
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Medium
Stuart McLaren

Bug Description

An image is owned by an admin user:

glance --os-username glance --os-password XXX --os-tenant-name service --os-auth-url http://localhost:5000/v2.0 image-show 15553526-082c-44a9-80d9-4d1fab83fd2d
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | 3e2a7777fb3c370e7affc625ac0ace05 |
| container_format | bare |
| created_at | 2013-05-08T12:40:43 |
| deleted | False |
| disk_format | raw |
| id | 15553526-082c-44a9-80d9-4d1fab83fd2d |
| is_public | False |
| min_disk | 0 |
| min_ram | 0 |
| name | admin-priv |
| owner | ad9ddbf47b564e65b9e258624fde699c |
| protected | False |
| size | 667 |
| status | active |
| updated_at | 2013-05-08T12:40:43 |
+------------------+--------------------------------------+

Another user attempts to use that id as a marker:

curl -v -H "x-auth-token: `cat ~/demo.token`" 'http://localhost:9292/v1/images/detail?marker=15553526-082c-44a9-80d9-4d1fab83fd2d'

< HTTP/1.1 500 Internal Server Error
< Content-Type: text/plain
< Content-Length: 5014
< Date: Thu, 09 May 2013 15:42:00 GMT
< Connection: close
<
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/eventlet/wsgi.py", line 383, in handle_one_response
    result = self.application(self.environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/opt/stack/glance/glance/common/wsgi.py", line 367, in __call__
    response = req.get_response(self.application)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1296, in send
    application, catch_exc_info=False)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1260, in call_application
    app_iter = application(self.environ, start_response)
  File "/opt/stack/python-keystoneclient/keystoneclient/middleware/auth_token.py", line 451, in __call__
    return self.app(env, start_response)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/opt/stack/glance/glance/common/wsgi.py", line 367, in __call__
    response = req.get_response(self.application)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1296, in send
    application, catch_exc_info=False)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1260, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/opt/stack/glance/glance/common/wsgi.py", line 367, in __call__
    response = req.get_response(self.application)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1296, in send
    application, catch_exc_info=False)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1260, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/opt/stack/glance/glance/common/wsgi.py", line 367, in __call__
    response = req.get_response(self.application)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1296, in send
    application, catch_exc_info=False)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1260, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.7/dist-packages/paste/urlmap.py", line 203, in __call__
    return app(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
    return resp(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/routes/middleware.py", line 131, in __call__
    response = self.app(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
    return resp(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/opt/stack/glance/glance/common/wsgi.py", line 591, in __call__
    request, **action_args)
  File "/opt/stack/glance/glance/common/wsgi.py", line 608, in dispatch
    return method(*args, **kwargs)
  File "/opt/stack/glance/glance/api/v1/images.py", line 204, in detail
    images = registry.get_images_detail(req.context, **params)
  File "/opt/stack/glance/glance/registry/client/v1/api.py", line 148, in get_images_detail
    return c.get_images_detailed(**kwargs)
  File "/opt/stack/glance/glance/registry/client/v1/client.py", line 115, in get_images_detailed
    res = self.do_request("GET", "/images/detail", params=params)
  File "/opt/stack/glance/glance/registry/client/v1/client.py", line 90, in do_request
    **kwargs)
  File "/opt/stack/glance/glance/common/client.py", line 62, in wrapped
    return func(self, *args, **kwargs)
  File "/opt/stack/glance/glance/common/client.py", line 376, in do_request
    headers=headers)
  File "/opt/stack/glance/glance/common/client.py", line 79, in wrapped
    return func(self, method, url, body, headers)
  File "/opt/stack/glance/glance/common/client.py", line 514, in _do_request
    raise exception.ServerError()
ServerError: The request returned 500 Internal Server Error.
* Closing connection #0

3344 DEBUG eventlet.wsgi.server [a7ad61ac-7c6b-415d-b88c-eee46d8c28a4 7fd88ea49a01438a9cd5ff9bc62cc9c3 05ec9af64459466881e2dd121245743b] Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/eventlet/wsgi.py", line 383, in handle_one_response
    result = self.application(self.environ, start_response)
  File "/opt/stack/python-keystoneclient/keystoneclient/middleware/auth_token.py", line 451, in __call__
    return self.app(env, start_response)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/opt/stack/glance/glance/common/wsgi.py", line 367, in __call__
    response = req.get_response(self.application)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1296, in send
    application, catch_exc_info=False)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1260, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
    return resp(environ, start_response)
  File "/usr/lib/python2.7/dist-packages/routes/middleware.py", line 131, in __call__
    response = self.app(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
    return resp(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/opt/stack/glance/glance/common/wsgi.py", line 591, in __call__
    request, **action_args)
  File "/opt/stack/glance/glance/common/wsgi.py", line 608, in dispatch
    return method(*args, **kwargs)
  File "/opt/stack/glance/glance/registry/api/v1/images.py", line 124, in detail
    images = self._get_images(req.context, **params)
  File "/opt/stack/glance/glance/registry/api/v1/images.py", line 72, in _get_images
    **params)
  File "/opt/stack/glance/glance/db/sqlalchemy/api.py", line 604, in image_get_all
    force_show_deleted=showing_deleted)
  File "/opt/stack/glance/glance/db/sqlalchemy/api.py", line 303, in _image_get
    raise exception.Forbidden("Image not visible to you")
Forbidden: Image not visible to you

Changed in glance:
assignee: nobody → Stuart McLaren (stuart-mclaren)
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/28794

Changed in glance:
status: New → In Progress
Changed in glance:
importance: Undecided → Medium
tags: added: grizzly-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/28794
Committed: http://github.com/openstack/glance/commit/8885c30e3a27621a9d539e9e8d54b4ad451465c4
Submitter: Jenkins
Branch: master

commit 8885c30e3a27621a9d539e9e8d54b4ad451465c4
Author: Stuart McLaren <email address hidden>
Date: Fri May 10 12:34:46 2013 +0000

    Prevent '500' error when using forbidden marker

    If an existing image id was used as a marker, but
    the user didn't have access to that image a '500'
    error occurred. Return '400' instead.

    Fixes bug 1178307.

    Change-Id: Ib632297d944a19e18694fff154307a3bc6d5b625

Changed in glance:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in glance:
milestone: none → havana-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in glance:
milestone: havana-1 → 2013.2
Alan Pevec (apevec)
tags: removed: grizzly-backport-potential
no longer affects: glance/grizzly
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.