fix: make v4 signing formatting consistent w/ spec#56
Merged
Conversation
Prep for review / update of *V4* canonicalization.
frankyn
suggested changes
Feb 12, 2020
google/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: |
Contributor
There was a problem hiding this comment.
Only support x-goog- and ignore x-amz.
Per review from @frankyn
frankyn
suggested changes
Feb 12, 2020
tests/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)) |
Contributor
There was a problem hiding this comment.
Does this encode '/' as well? It should not.
Contributor
Author
There was a problem hiding this comment.
It does not: it is actually designed to quote the path part.
Contributor
There was a problem hiding this comment.
This might hit an issue with conformance tests when that's added but approving for now.
Contributor
Author
There was a problem hiding this comment.
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.
The caller already URL-encodes the 'resource' path. and so we don't want to do it here. Reverts commit 6cc5f8a.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #12
W/ exception of query string parameter quoting bits being addressed in PR #48.