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

fix(signature-v4): normalized the path before double encoding it #3408

Merged
merged 1 commit into from
Mar 10, 2022

Conversation

AllanZhengYP
Copy link
Contributor

Issue

P59814336
If customer make make MediaStoreData::PutObject API call with SDK, but mistakenly use the absolute path for Path parameter, they will get invalid signature error, for example:

const client = new MediaStoreDataClient({
  endpoint: "https://[store].data.mediastore.us-west-2.amazonaws.com",
});

client.send(
  new PutObjectCommand({
    Path: "/some/path", // <== should not lead by slash
    Body: "hello",
  }),
  console.log
);

However the same call doesn't fail in AWS CLI. The route cause being the path in the request sent to the wire is //some/path, but the server side strips the redundant slashes. Since the signature is generated with double slashes, the invalid signature error raises.

This change adopts the same behavior as Botocore to strip reduntant slashes.

This change also normalize the relative Unix path according to the RFC3986

Description

ref: https://github.com/boto/botocore/pull/827/files

Testing

Unit test


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@AllanZhengYP AllanZhengYP merged commit b20d431 into aws:main Mar 10, 2022
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants