Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefix key containing space throws S3Error with 403 SignatureDoesNotMatch response #54

Open
lionel-rowe opened this issue Feb 15, 2023 · 1 comment · May be fixed by lucacasonato/deno_aws_sign_v4#18 or #55

Comments

@lionel-rowe
Copy link

lionel-rowe commented Feb 15, 2023

Running the following:

await bucket.listObjects({ prefix: 'Project/contains%20space/', delimiter: '/' })

Throws Uncaught (in promise) S3Error: Failed to get object: 403 Forbidden. The XML response (edited slightly) is as follows:

<?xml version='1.0' encoding='utf-8' ?>
<Error>
    <Code>SignatureDoesNotMatch</Code>
    <Message>The Signature you specified is invalid.</Message>
    <StringToSign>AWS4-HMAC-SHA256
20230215T112132Z
20230215/us/s3/aws4_request
732f5c6ccaf026fa19202ad9e73efc4eb173d06fffc4afd58d4751fe37e9bf12</StringToSign>
    <CanonicalRequest>GET
/example-bucket/
delimiter=%2F&amp;list-type=2&amp;max-keys=1000&amp;prefix=contains%20space%2F
host:example.com
x-amz-date:20230215T112132Z

host;x-amz-date
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855</CanonicalRequest>
    <Resource>/</Resource>
    <RequestId>NjNlY2MwM2NfOTk0ZTQ0MGJfMTAwOTNfZTNjZjA3Mw==</RequestId>
    <TraceId>OGVmYzZiMmQzYjA2OWNhODk0NTRkMTBiOWVmMDAxODc0OWRkZjk0ZDM1NmI1M2E2MTRlY2MzZDhmNmI5MWI1OTBjYzE2MjAxN2M1MzJiOTdkZjMxMDVlYTZjN2FiMmI0Njk3ZTgyYTM4NDJmM2I0ZDViYzAxY2M1MTMzNmM4OWY=</TraceId>
</Error>

Prefixes not containing spaces are unaffected.

@lionel-rowe
Copy link
Author

Not sure how actively this repo's being maintained, but I've made a fork available here that includes my PR fixes for this and #52.

https://github.com/lionel-rowe/deno_s3/tree/v0.5.0-fork
https://cdn.jsdelivr.net/gh/lionel-rowe/[email protected]/mod.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant