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

fix: make v4 signing formatting consistent w/ spec - #56

Merged
tseaver merged 8 commits into
masterfrom
12-fix-v4-signing-formatting
Feb 13, 2020
Merged

fix: make v4 signing formatting consistent w/ spec#56
tseaver merged 8 commits into
masterfrom
12-fix-v4-signing-formatting

Conversation

@tseaver

Copy link
Copy Markdown
Contributor

Fixes#12

W/ exception of query string parameter quoting bits being addressed in PR #48.

@tseavertseaver added the api: storage Issues related to the googleapis/python-storage API. label Feb 12, 2020
@googlebotgooglebot added the cla: yes This human has signed the Contributor License Agreement. label Feb 12, 2020

@frankynfrankyn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have one nit overall LGTM, thanks @tseaver.

Comment threadgoogle/cloud/storage/_signing.py Outdated

if "x-goog-content-sha256" in lowercased_headers:
payload = lowercased_headers["x-goog-content-sha256"]
elif "x-amz-content-sha256" in lowercased_headers:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only support x-goog- and ignore x-amz.

@frankynfrankyn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question, but overall LGTM. Thanks @tseaver

Comment threadtests/unit/test__signing.py Outdated
self.assertEqual(scheme, expected_scheme)
self.assertEqual(netloc, expected_netloc)
self.assertEqual(path, resource)
self.assertEqual(path, six.moves.urllib.parse.quote(resource))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this encode '/' as well? It should not.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not: it is actually designed to quote the path part.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might hit an issue with conformance tests when that's added but approving for now.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it happens, I backed it out here, because the bucket / blob already do the urlencoding of the resource before calling _sigining.generate_signed_url_v4.

@frankynfrankyn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

The caller already URL-encodes the 'resource' path. and so we
don't want to do it here.
Reverts commit 6cc5f8a.
@tseavertseaver mentioned this pull request Feb 12, 2020
@tseavertseaver added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 13, 2020
@yoshi-kokoroyoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 13, 2020
@tseaver
tseaver merged commit 8712da8 into masterFeb 13, 2020
@tseaver
tseaver deleted the 12-fix-v4-signing-formatting branch August 24, 2021 18:07
cojenco pushed a commit to cojenco/python-storage that referenced this pull request Oct 13, 2021
* Rename 'canonicalize' to show V2 only.
* Refactor / simplify header whitespace normalization.
* Sign user-supplied payload hash.
cojenco pushed a commit to cojenco/python-storage that referenced this pull request Oct 13, 2021
* Rename 'canonicalize' to show V2 only.
* Refactor / simplify header whitespace normalization.
* Sign user-supplied payload hash.
@release-pleaserelease-pleaseBot mentioned this pull request Jan 12, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: storageIssues related to the googleapis/python-storage API.cla: yesThis human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Storage] V4 Signature: Formatting Inconsistencies

4 participants

@tseaver@frankyn@googlebot@yoshi-kokoro