-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Storage: add support for V4 signed URLs #7460
Conversation
The docs build failure on CI is unrelated to this PR: it was fixed in #7458. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing a first pass.
.. note:: | ||
|
||
If you are on Google Compute Engine, you can't generate a signed URL. | ||
Follow `Issue 922`_ for updates on this. If you'd like to be able to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tseaver this is supported in the Python auth library. Is this a typo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@frankyn googleapis/google-auth-library-python#50 is still open: AFAIK, the only way to get signing done on GCE is to use the IAM-based workaround. I plan to add that here (following your Ruby PoC) once we're OK with the surface.
@frankyn A question: the current Python V2 version allows for passing |
At a blob level, yes. The resumable header is also supported when using V4 signed URLs. One request I have is to state in the documentation that the |
Flaky spanner systest reported in #7504. |
@crwilcox Can you check what is hanging the Kokoro builds here? |
@tseaver please do not support signed URLs at a client level. |
@tseaver do you need anything from me to move this along? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Python doesn't have the timestamp offset bug mentioned in email.
@frankyn I believe the only remaining work is to add support for IAM / access token signing: note that the feature does not exist yet for V2 in Python. |
@@ -387,16 +432,25 @@ def generate_signed_url( | |||
client = self._require_client(client) | |||
credentials = client._credentials | |||
|
|||
return generate_signed_url( | |||
if version == "v2": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tseaver could you add a warning as log output that V2 will change to V4 in the future:
You have generated a signed URL using the default v2 signing implementation. In the future, this will default to v4. You may experience breaking changes if you use longer than 7 day expiration times with v4. To opt-in to the behavior specify
version="v2"
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exclusive with 'expiration', to permit clearer semantics for users.
Headers have to be sorted *after* lower-casing the keys.
In addition to stripping leading / trailing spaces, collapse multiple interior spaces into one.
@frankyn PTAL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two nits and LGTM.
Thanks @tseaver!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, pending tests. Thanks @tseaver!
Partial support for the new feature: adds a
version
argument toBlob.generate_signed_url
, and uses it to switch between the two signing algorithms.Remaining work:
Bucket.generate_signed_url
, to permit listing bucket contents.Deferred work:
X-Goog-Signed
header) (Storage: un-skip system tests for 'Bucket.generate_signed_url' #7625).No longer in scope:
AddClient.generate_signed_url
, to permit listing buckets.