Invalid account acl header value generates 500 response

Bug #1281626 reported by Alistair Coles
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Fix Released
Undecided
Alistair Coles

Bug Description

Sending an X-Account-Access-Control header with value that is valid json but not a valid account ACL sometimes results in a 500 Internal Error being returned, other times a 400 Bad Request is returned. Should always be a 400.

For example:
$ curl http://myhost:8080/v1/AUTH_test -H "X-Auth-Token:mytoken" -X POST -i -H 'X-Account-Access-Control:["admin"]'
HTTP/1.1 500 Internal Error
Content-Length: 125
Content-Type: text/html; charset=UTF-8
X-Trans-Id: tx8e9582c85d5f4ff98e494-0053037731
Date: Tue, 18 Feb 2014 15:07:29 GMT

<html><h1>Internal Error</h1><p>The server has either erred or is incapable of performing the requested operation.</p></html>

$ curl http://myhost:8080/v1/AUTH_test -H "X-Auth-Token:mytoken" -X POST -i -H 'X-Account-Access-Control:2'
HTTP/1.1 500 Internal Error
Content-Length: 125
Content-Type: text/html; charset=UTF-8
X-Trans-Id: tx9015d27661e94e0487132-005303776f
Date: Tue, 18 Feb 2014 15:08:31 GMT

<html><h1>Internal Error</h1><p>The server has either erred or is incapable of performing the requested operation.</p></html>

$ curl http://myhost:8080/v1/AUTH_test -H "X-Auth-Token:mytoken" -X POST -i -H 'X-Account-Access-Control:{"admin":2}'
HTTP/1.1 400 Bad Request
Content-Length: 91
Content-Type: text/plain; charset=UTF-8
X-Trans-Id: tx911dc715f7f3410f8f03c-0053037c90
Date: Tue, 18 Feb 2014 15:30:24 GMT

X-Account-Access-Control invalid: Value for key 'admin' must be a list

Input: {"admin":2}

Changed in swift:
assignee: nobody → Alistair Coles (alistair-coles)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to swift (master)

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

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

Reviewed: https://review.openstack.org/74417
Committed: https://git.openstack.org/cgit/openstack/swift/commit/?id=36adcb6c66bf0c0093ead1080078ca8154b0d158
Submitter: Jenkins
Branch: master

commit 36adcb6c66bf0c0093ead1080078ca8154b0d158
Author: anc <email address hidden>
Date: Tue Feb 18 14:07:37 2014 +0000

    Fix invalid account acl generating 500 response.

    Sending an account POST with an X-Account-Access-Control
    header value that is valid json but not a valid ACL was
    causing a 500 Internal Error if the value did not parse
    to a dict due to an exception being raised in tempauth.py.

    This patch modifies acl.py to check that the header value
    is both json and parses to a dict. The existing
    tests are extended to cover these invalid header values.

    This patch also enables json encoded dicts with whitespace
    (e.g. '{ }') to be accepted as a value for
    X-Account-Access-Control in the same way that '{}' is.
    These previously resulted in a 400 response.

    Closes-bug: 1281626

    Change-Id: Ia06ba9c9d16f749f801a8158e73d3898c4a42888

Changed in swift:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in swift:
milestone: none → 1.13.0
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to swift (feature/ec)

Fix proposed to branch: feature/ec
Review: https://review.openstack.org/77244

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to swift (feature/ec)
Download full text (12.9 KiB)

Reviewed: https://review.openstack.org/77244
Committed: https://git.openstack.org/cgit/openstack/swift/commit/?id=2c22fb0a17e1192b95d0b823dfce144779579944
Submitter: Jenkins
Branch: feature/ec

commit dc5c5fb4011cc8dee9b149e668dc8534ac7f51e0
Author: Hou Ming Wang <email address hidden>
Date: Wed Feb 26 20:53:10 2014 +0800

    Remove blank space after print

    Check Swift code, remove blank space after print.

    Change-Id: Ia7838ac5f33f2b335d1cd664b017e87118262d29

commit b6eda4a40bd55771771ca8039e9c3ad39ff7de11
Author: John Dickinson <email address hidden>
Date: Sun Feb 23 15:24:47 2014 -0800

    AUTHORS and CHANGELOG update for 1.13 release

    Change-Id: I6195c70cbbd7c94682539962dd5410e3665f01ac

commit 3357a58ea2a8fc35e6672c52028e59fbafe7fcb7
Author: Matt Kassawara <email address hidden>
Date: Thu Feb 20 20:27:20 2014 -0700

    Alphabetized items under "Middleware" in source documentation

    I alphabetized the items under "Middleware" in the source documentation
    to make them easier to locate.

    Change-Id: I3a0108c89d16ef07b7623dda518b3096c2686002

commit beaa2b8744841acac5af1a2171a358f58d7288be
Author: John Dickinson <email address hidden>
Date: Sun Feb 23 10:22:34 2014 -0800

    tabs to spaces

    Change-Id: Ie3d3af87df8f72792abf345c0d4dcfe2be1f4141

commit f42cb54002eaaa1f82a7a489802afc85412e2ce1
Author: Samuel Merritt <email address hidden>
Date: Fri Feb 21 16:49:22 2014 -0800

    Refactor a quorum-size calculation

    No behavior change, just use the utility function instead of rolling
    our own.

    Change-Id: I152ccd8f22f424cd7547fa4d67df020f263096a9

commit 5dfa0bd3fba6fe414f7a6ed9d7d19f9dea25445e
Author: Matt Kassawara <email address hidden>
Date: Fri Feb 21 10:59:29 2014 -0700

    Alphabetized items under other sections in source documentation

    I alphabetized the items under "Proxy", "Account", "Container",
    and "Object" in the source documentation to make them easier to
    locate.

    Change-Id: Ia9cca0ee558cb1e0361c1a88103352bd006da1e3

commit 38e015e871add82889d1e7999b35b795f4a7d1f5
Author: Samuel Merritt <email address hidden>
Date: Thu Feb 20 23:01:00 2014 -0800

    Functional tests for DLO If-Match/If-None-Match

    Change-Id: I4a731a3836eb0f58b897ee43477b3b76d2344a81

commit 46250171ef285b0d297b05f413f1a27ff1dbdb65
Author: Samuel Merritt <email address hidden>
Date: Thu Feb 20 22:01:39 2014 -0800

    Functional tests for SLO If-Match/If-None-Match

    Change-Id: Ib70f579f5edebc7b1586e5f51fee5769bcaa9931

commit 25ebf3aa9e6e98974565ae1b70fc05b49423e17c
Author: Samuel Merritt <email address hidden>
Date: Thu Feb 20 20:33:00 2014 -0800

    Raise error on long or short DLO

    The GET response for a DLO has a Content-Length that's computed from
    the container listing, but the response body's length is determined by
    the segments. If a segment grows or shrinks between when the headers
    are sent and when the segment is requested, this confuses clients.

    For example, if the DLO is longer than its Content-Length and the
    client sends another request on the same TCP connection, then it can
    get leftover object bytes instea...

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.