mirror of
https://github.com/fsouza/fake-gcs-server.git
synced 2026-04-28 07:05:52 +03:00
[GH-ISSUE #941] make_public fails due to invalid "projectOwner" ACL entity #148
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#148
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 @marcguidancenl on GitHub (Oct 5, 2022).
Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/941
I'm just getting started on Google Cloud Storage, so please correct me if I'm doing something the wrong way. And, thanks for the emulator, it helps a lot.
The dev setup: fake-gcs-server is running in a Docker container, and I'm using Google's Python client. I've created buckets and files in buckets. The buckets are private by default (I think).
Now I want to make a single file public, using
This gives me an exception that looks a bit like this:
As far as I can tell, 'projectOwner' isn't a valid entity (https://cloud.google.com/storage/docs/access-control/lists#scopes). This value is returned from getObjectACL in upload.go, if there is no predefinedACL (I don't know Go either, just reading it to find some clues...).
The Google Python Client (https://github.com/googleapis/python-storage/blob/main/google/cloud/storage/acl.py) tries to create an ACL after the reload(), but it only recognizes 'allUsers', 'allAuthenticatedUsers', or entity-strings with a dash in them (
elif "-" in entity).The 'projectOwner' value triggers a ValueError:
If I look for the projectOwner value in the Google documentation, I can find it for the gsutil tool, but in relation to IAM, not ACL (these are related too, but different enough).
I'm not sure what
getObjectACLshould return if there is no predefinedACL. Perhaps an empty list? It looks like that's what blob.acl.clear() does.My current workaround is to just disable make_public and make_private in the dev environment, and hope all is well when I switch to an actual GCS environment for testing. I would be really happy if I can get this working in my dev environment too.
Thanks, Marc.
@fsouza commented on GitHub (Oct 6, 2022):
@marcguidancenl thanks for reporting! Can you try #943?
@marcguidancenl commented on GitHub (Oct 6, 2022):
#943 did solve the issue, but while testing I discovered that I also got another ACL error when using make_public on data that is used to initialize the docker container.
this is the sample python code:
this gives
TypeError: 'NoneType' object is not iterablein google/cloud/storage/acl.py", line 398(as far as I can tell this is somewhere in
response.gofrom aclListResponse to getAccessControlsListFromObject, where it somehow returns {"items":null} instead of {"items":[]} ??)Doing the same thing with a bucket and blob created from code works now (needs #943), but I did notice that the ACL doesn't actually get changed with make_public and make_private. Sample code:
this lists the ACL three times - initial ACL, public ACL, and private ACL:
Should this be two new, separate issues?
I don't really mind these issues, since I don't use the docker-image-initial-data and I don't check the ACLs, so I'm happy with the #943 fix :-)
@fsouza commented on GitHub (Oct 6, 2022):
Thank you for the detailed report. There's probably a lot of things to investigate around ACLs. Can you open separate GH issues for those issues?
@marcguidancenl commented on GitHub (Oct 6, 2022):
Sure, done :)