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

GoogleCloud: Use V4 signed URLs #994

Merged
merged 1 commit into from
Oct 1, 2021

Conversation

martey
Copy link
Contributor

@martey martey commented Mar 22, 2021

Update URL signing version from v2 to v4. Increase minimum google-cloud-storage library version so that custom endpoints work
properly.

This supersedes #837 - moving to v4 signed URLs and using bucket_bound_hostname will fix the bug with invalid signed URLs being generated without having to resort to the hackish solution used in that pull request.

@martey
Copy link
Contributor Author

martey commented Apr 11, 2021

@jschneier I would appreciate your feedback on this - this solves the bug with using signed URLs with a custom endpoint on GCS, but it isn't as hackish as my earlier attempt.

@jschneier
Copy link
Owner

@martey I think the fix is good but am concerned about breaking backwards compat.

I recall when I upgraded S3 to use s3v4 alone I had to revert because people had persisted the output of url to the DB. I also realize that GCloud doesn't allow URLs to hang around for longer than 7 days anymore.

What do you think?

@jschneier
Copy link
Owner

Yeah okay let’s take this. Can you rebase?

@jschneier
Copy link
Owner

Does this require the higher google-cloud-storage library? It’s fine, just want to document if so.

Update URL signing version from v2 to v4. Increase minimum
google-cloud-storage library version so that custom endpoints work
properly.
@martey
Copy link
Contributor Author

martey commented Sep 30, 2021

I have rebased this.

This pull request does require at least google-cloud-storage 1.27. That version adds custom endpoint/hostname support for v4 signed URLs. Before that version, it wasn't possible to natively create a signed URL with a custom endpoint (which is why my previous fix for signed URLs and custom endpoints in #837 created a signed URL and then manually added the custom endpoint).

Since Google is now recommending that users use v4 signing instead of v2 signing (see the first "Important" note on https://cloud.google.com/storage/docs/access-control/signed-urls-v2), and this fixes a bug (using signed URLs and a custom endpoint fails), I personally don't see an issue with this being a breaking change.

@jschneier jschneier merged commit 7ecaf37 into jschneier:master Oct 1, 2021
mlazowik pushed a commit to qedsoftware/django-storages that referenced this pull request Mar 9, 2022
Update URL signing version from v2 to v4. Increase minimum
google-cloud-storage library version so that custom endpoints work
properly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants