Trying to auth with a bad request reply with a KeyError

Bug #1044032 reported by Chmouel Boudjnah
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
High
Dolph Mathews

Bug Description

When trying to auth with this :

stack@devstack:~$ curl -i http://localhost:5000/v2.0/tokens -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "User-Agent: python-novaclient" -d '{"auth": {"RAX-KSKEY:apiKeyCredentials": {"username": "admin", "apiKey": "pass", "tenantName": "admin"}}}'

I am getting a key error :

HTTP/1.1 500 Internal Server Error
Vary: X-Auth-Token
Content-Type: application/json
Content-Length: 196
Date: Thu, 30 Aug 2012 19:35:23 GMT

{"error": {"message": "An unexpected error prevented the server from fulfilling your request. local variable 'expiry' referenced before assignment", "code": 500, "title": "Internal Server Error"}}

and server log :

(root): 2012-08-30 19:35:23,078 ERROR wsgi __call__ local variable 'expiry' referenced before assignment
Traceback (most recent call last):
  File "/opt/stack/keystone/keystone/common/wsgi.py", line 204, in __call__
    result = method(context, **params)
  File "/opt/stack/keystone/keystone/service.py", line 423, in authenticate
    auth_token_data['expires'] = expiry
UnboundLocalError: local variable 'expiry' referenced before assignment
(eventlet.wsgi.server): 2012-08-30 19:35:23,080 DEBUG wsgi write 5.79.6.29 - - [30/Aug/2012 19:35:23] "POST /v2.0/tokens HTTP/1.1" 500 344 0.005041

Tags: trunk
tags: added: trunk
Adam Young (ayoung)
Changed in keystone:
assignee: nobody → Adam Young (ayoung)
Joseph Heck (heckj)
Changed in keystone:
status: New → Triaged
importance: Undecided → High
Revision history for this message
stelford (stef-ummon) wrote :

This stops the 500 explosion and returns a 403 Forbidden.

The request that explodes is 'improperly formatted', at least with regards to keystone/service.py; which expects a token in the request body specifically, or an auth dict in the format at line 272 in the authenticate method.

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

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

Changed in keystone:
assignee: Adam Young (ayoung) → Dolph Mathews (dolph)
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (master)

Reviewed: https://review.openstack.org/14208
Committed: http://github.com/openstack/keystone/commit/0fded564f12e62cba2e163ef74074d03b5d2347f
Submitter: Jenkins
Branch: master

commit 0fded564f12e62cba2e163ef74074d03b5d2347f
Author: Dolph Mathews <email address hidden>
Date: Tue Oct 9 09:22:03 2012 +0000

    Raise 400 if credentials not provided (bug 1044032)

    This request:

        POST /v2.0/tokens

        {
            "auth": {
                "RAX-KSKEY:apiKeyCredentials": {
                    "apiKey": "pass",
                    "tenantName": "admin",
                    "username": "admin"
                }
            }
        }

    Now results in:

        400 Bad Request

        {
            "error": {
                "code": 400,
                "message": "Expecting to find passwordCredentials or token in auth. The server could not comply with the request since it is eithermalformed or otherwise incorrect. The client is assumed to be in error.",
                "title": "Bad Request"
            }
        }

    Change-Id: I5caf2b15b1bf60e0e31e8afcc7fc227744bd933a

Changed in keystone:
status: In Progress → Fix Committed
Joseph Heck (heckj)
Changed in keystone:
milestone: none → grizzly-1
Thierry Carrez (ttx)
Changed in keystone:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in keystone:
milestone: grizzly-1 → 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.