Skip to content
This repository was archived by the owner on Mar 9, 2026. It is now read-only.
This repository was archived by the owner on Mar 9, 2026. It is now read-only.

Signer does not match official Signature Version 4 Test Suite #853

Description

@mhart

There is a test suite provided here:

http://docs.aws.amazon.com/general/latest/gr/signature-v4-test-suite.html

And there is also documentation provided here:

http://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html

That says "Normalize URI paths according to RFC 3986 by removing redundant and relative path components".

As the documentation implies above, and as the test suite shows, there are some examples of requests (in get-relative.sreq and get-slashes.sreq in the test suite, among others) where the request provided is, say, GET /foo/.. http/1.1 and the expected canonical request (in get-relative.creq) is resolved to /.

However, this is not what the aws-sdk does:

var req = new AWS.S3().getObject({Bucket: 'bucket', Key: '//key//..//whatever/.'}).build()
console.log(new AWS.Signers.V4(req.httpRequest, 's3').canonicalString())

Results in:

GET
///key//..//whatever/.

host:bucket.s3.amazonaws.com
x-amz-date:Sun, 27 Dec 2015 16:02:10 GMT

host;x-amz-date
e3b0c44298fc1c149afbf4c5113fb92427ae41e4649b934ca495991b7852b855

If the SDK was resolving according to the documentation (and test suite), then the canonical request would be /whatever/ instead of ///key//..//whatever/. – so the SDK doesn't actually pass the test suite (I can provide you with the exact tests it fails if you like).

An important thing to note here is that it appears that the actual AWS services themselves also don't appear to adhere to the documentation or test suite.

So, I'm left wondering if it's actually the test suite and documentation themselves that are incorrect – because both the SDK and actual AWS services appear not to do any normalisation whatsoever. However, it would be good to clarify this and determine which source is actually correct!

Metadata

Metadata

Assignees

No one assigned

    Labels

    guidanceQuestion that needs advice or information.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions