mirror of
https://github.com/fsouza/fake-gcs-server.git
synced 2026-04-26 06:05:54 +03:00
[GH-ISSUE #381] Signed URLs? #72
Labels
No labels
bug
compatibility-issue
docker
documentation
enhancement
help wanted
needs information
pull-request
question
stale
unfortunate
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/fake-gcs-server#72
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @steezeburger on GitHub (Dec 11, 2020).
Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/381
Hey thanks for the docker image! I got everything running locally, but I'm curious, does this support generating signed upload and download URLs?
@kenniaa commented on GitHub (Dec 20, 2020):
It does in fact support signed URLs.
There should be no additional setup on the
fake-gcs-serverside outside of creating the bucket. If you run into CORS issues over unsupported headers, you can pass in the-cors-headersflag with a list of comma separated headers.@fsouza commented on GitHub (Dec 22, 2020):
@steezeburger signed urls are generated by the client and as far I understand they only have some extra querystring parameters which we ignore, so yes they should work. There's no validation of the signature though, so if you're using this to test that your client signs the URL correctly you may want to use a different strategy.
@steezeburger commented on GitHub (Dec 22, 2020):
Thanks @kenniaa and @fsouza
I realized I was also needing a mock of the cloud storage SDK, not just the endpoints. This library is still super helpful though, I just misunderstood my needs and what this repo solves. Thanks again for the work and replies!
@fsouza commented on GitHub (Dec 22, 2020):
@steezeburger no problem, I'm sorry it took me so long to get to this (EOY productivity slump heh). Feel free to open new issues in the future if you have questions! :D
@vikramray-fc commented on GitHub (Sep 27, 2021):
Hi, thanks for this project. I was able to generate a download url
http://0.0.0.0:4443/storage/v1/b/bucket/o/example.json?alt=mediabut I am not able to generate upload URL, any example would be helpful. Thanks!@fsouza commented on GitHub (Oct 1, 2021):
Hmm it should just work. Can you share a snippet of code that you expected to work and didn't work? Thanks!
@vikramray-fc commented on GitHub (Dec 7, 2021):
Hi @fsouza, Sorry for late response.
I have generated a signed URL from the gcp code snippet and its working for cloud storage. (without emulator)
While using emulator, I generated a signed URL with the above snippets, it returned -
https://storage.googleapis.com/fc/uploads/vikram.com/ojoijoijoi.csv?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=fc-team%40vikram1.iam.gserviceaccount.com%2F20211207%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20211207T091804Z&X-Goog-Expires=1800&X-Goog-SignedHeaders=content-type%3Bhost&X-Goog-Signature=88355ed841e88bfbdfedff41bd59ss287701ed298e7e20a29bd107f7e23fd5f54b960b2da753879661f1120f833db4ca1c362f5e515ca0dad89cc128f3640a9ead0c4dce9500b44469d74d6fde07f3dd2c563a891c450bdb899c40904cc4d71b718be0a48298a48eabbc5e6e8d31336ad0fa1aebf0588add5b7141e8140e0434d59879ed9656e7f4d0c7cdc70b9a1900574e4169688dcc508d7330b7ed12d4ddf8f2cbbdd74e948bb1ae9f1af52f48648127a89a5221c326d103cca1a1710f3e6f35ed5263110bd15379f6559404106e113ae1b82a37076390ef6c5255a69abacd7ec48bdd8df5ee5c44454c997c0365fd2ed16a4b83da341dfe10403916e9be9beWhich is not a emulator URL and also i tried replacing the
https://storage.googleapis.comwithhttp://127.0.0.1:4443but it didnt worked.Any help will be useful.
@thaont-0210 commented on GitHub (Feb 22, 2022):
@vikramray-fc
I think you have found your own solution, but I think my solution can help some one other.
In Go,
SignedURLOptionshave property isStyle, we use styleBucketBoundHostnameas below.uwill be encoded, so, url will behttp://localhost:8080%2Fbucket-hihi/abc.csv......=> we need decode that urlI use signed url for get method, I think put the same
@mj3c commented on GitHub (Mar 16, 2022):
I did not manage to generate a signed URL for uploading using Python. Regular uploading/downloading of blobs work.
Here's what I tried:
This is the error:
AttributeError: you need a private key to sign credentials.the credentials you are currently using <class 'google.auth.credentials.AnonymousCredentials'> just contains a token. see https://googleapis.dev/python/google-api-core/latest/auth.html#setting-up-a-service-account for more details.And this is from the
generate_signed_urldocstring:I tried creating a gcp.json file with all fake values and using that when initializing the
Clientbut then got an error:google.auth.exceptions.RefreshError: ('invalid_grant: Invalid grant: account not found', {'error': 'invalid_grant', 'error_description': 'Invalid grant: account not found'})Any ideas on how to work around this?
@fxn commented on GitHub (May 30, 2022):
Facing the same issue.
@fxn commented on GitHub (May 31, 2022):
Tried using this class
For a dummy private key generated with
openssl, and I get pass that error message, to now get a HTTP response ofCan anybody help? This is just for a test suite.
@papagian commented on GitHub (Feb 21, 2025):
Recover from reauth related error worked for me!