HTTP Code 500 Returned on bad CA resource in URL

Bug #1496819 reported by Dave McCowan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Barbican
Fix Released
High
Dave McCowan

Bug Description

Recreate Steps
-----------------------
$curl -H 'content-type:application/json' -H "X-Auth-Token:$TOKEN" http://localhost:9311/v1/cas ; echo

{"cas": ["http://localhost:9311/v1/cas/23f269d1-2def-4ec7-8036-3b29c138ef45", "http://localhost:9311/v1/cas/2d7041bc-bbd1-468e-9bc5-666d57347cb3"], "total": 2}

$ curl -H 'content-type:application/json' -H "X-Auth-Token:$TOKEN" http://localhost:9311/v1/cas/23f269d1-2def-4ec7-8036-3b29c138ef45 ; echo

{"status": "ACTIVE", "updated": "2015-09-17T02:11:52.054309", "created": "2015-09-17T02:11:52.054309", "plugin_name": "barbican.plugin.simple_certificate_manager.SimpleCertificatePlugin", "meta": [{"ca_signing_certificate": "XXXXXXXXXXXXXXXXX"}, {"intermediates": "YYYYYYYYYYYYYYYY"}, {"description": "Certificate Authority - Simple CA"}, {"name": "Simple CA"}], "ca_id": "23f269d1-2def-4ec7-8036-3b29c138ef45", "plugin_ca_id": "Simple CA", "expiration": "2015-09-18T02:11:52.047218"}

$barbican dmccowan$ curl -H 'content-type:applicatison' -H "X-Auth-Token:$TOKEN" http://localhost:9311/v1/cas/23f269d1-2def-4ec7-8036-3b29c138ef45/foo ; echo
{"code": 500, "description": "Certificate Authority retrieval failure seen - please contact site administrator.", "title": "Internal Server Error"}

Traceback:
----------------
2015-09-17 08:03:01.771 69275 ERROR barbican.api.controllers [req-d4aed034-c754-4213-95eb-34690c2844cf aef5916109094125b7e52fdd7c43ecc2 0b0ea955139a4a0690a86f2d95310042 - default default] Certificate Authority retrieval failure seen - please contact site administrator.
2015-09-17 08:03:01.771 69275 ERROR barbican.api.controllers Traceback (most recent call last):
2015-09-17 08:03:01.771 69275 ERROR barbican.api.controllers File "/Users/dmccowan/barbican/barbican/api/controllers/__init__.py", line 104, in handler
2015-09-17 08:03:01.771 69275 ERROR barbican.api.controllers return fn(inst, *args, **kwargs)
2015-09-17 08:03:01.771 69275 ERROR barbican.api.controllers File "/Users/dmccowan/barbican/barbican/api/controllers/__init__.py", line 90, in enforcer
2015-09-17 08:03:01.771 69275 ERROR barbican.api.controllers return fn(inst, *args, **kwargs)
2015-09-17 08:03:01.771 69275 ERROR barbican.api.controllers TypeError: on_get() takes exactly 2 arguments (3 given)
2015-09-17 08:03:01.771 69275 ERROR barbican.api.controllers
2015-09-17 08:03:01.773 69275 INFO barbican.api.middleware.context [req-d4aed034-c754-4213-95eb-34690c2844cf aef5916109094125b7e52fdd7c43ecc2 0b0ea955139a4a0690a86f2d95310042 - default default] Processed request: 500 Internal Server Error - GET http://localhost:9311/v1/cas/23f269d1-2def-4ec7-8036-3b29c138ef45/foo
{address space usage: 2636541952 bytes/2514MB} {rss usage: 71565312 bytes/68MB} [pid: 69275|app: 0|req: 4/4] 127.0.0.1 () {28 vars in 1972 bytes} [Thu Sep 17 08:03:01 2015] GET /v1/cas/23f269d1-2def-4ec7-8036-3b29c138ef45/foo => generated 147 bytes in 8 msecs (HTTP/1.1 500) 4 headers in 191 bytes (2 switches on core 0)

Changed in barbican:
status: New → In Progress
assignee: nobody → Dave McCowan (dave-mccowan)
Revision history for this message
Dave McCowan (dave-mccowan) wrote :

Reviewed: https://review.openstack.org/224979
Committed: https://git.openstack.org/cgit/openstack/barbican/commit/?id=5b08265cbf98681a22f6cc7e84e23de3c967a64d
Submitter: Jenkins
Branch: master

commit 5b08265cbf98681a22f6cc7e84e23de3c967a64d
Author: Dave McCowan <email address hidden>
Date: Thu Sep 17 23:23:13 2015 -0400

    Add function to catch unknown attributes in URI

    Added a _lookup() function that will catch attribute after {CA_ID}/ in
    the URI that does not match a supported keyword (cacert, intermediates, etc.)
    Before this caused a 500 (server error) to be returned, now the correct
    404 (not found) error is returned.

    Change-Id: I0a15d4ebcbce58a807c4f4852b08b774c315ce0d

Changed in barbican:
status: In Progress → Fix Committed
Changed in barbican:
importance: Undecided → High
milestone: none → liberty-rc1
Thierry Carrez (ttx)
Changed in barbican:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in barbican:
milestone: liberty-rc1 → 1.0.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.