Skip to content

Repeated query string variables are sorted by value #97

Open
@lexanth

Description

@lexanth

We're using aws-sigv4-proxy to sign requests to send to an API gateway. We have some APIs that we're using which are sensitive to the order of the query string parameters.

e.g. ?a=1&a=2 is not equivalent to ?a=2&a=1. This seems uncommon but not unreasonable.

The proxy sorts query string variables by key and value, so if we send ?a=2&a=1, the service we're calling receives ?a=1&a=2 and responds accordingly.

I believe this comes from aws/aws-sdk-go#1495. https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html is now explicit that for the canonical request, the parameters must be sorted by value.

What I don't know is if the canonical request used to create the signature must exactly match the request we send, or would the API gateway recalculate the canonical signature according to those rules from the actual request it receives? If the latter, aws-sigv4-proxy could use the original request with the signature generated from the canonical request it creates.

We have some workarounds available, but it seems surprising that the proxy would mutate the request more than necessary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions