-
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
Issue Removing Last IAM Member from Bucket #4682
Comments
The GCS back-end is returning an error because it does not allow an empty IAM policy. ISTM that what you really want is to remove the policy altogether, but the GCS API docs don't show any support for that. |
Hi @tseaver, $ gsutil iam get gs://test-bucket-ep I then go into the console and select remove all permissions on the bucket (here are inherited permissions that allow me to still access the bucket). When I run the command a second time, all legacy permissions are gone: $ gsutil iam get gs://test-bucket-ep It's possible in the console, but I need to automate the removal using Python when any new buckets are created. Thanks for your help, |
Summoning @frankyn: can you tell us how the web console permits deleting the last binding in a bucket's IAM policy? |
Hi @frankyn, I'm trying to create a script that automates the removal of all these permissions since we're not using them and they're applied automatically on bucket creation. Just trying to use least privilege. |
Thanks for clarifying @ep-tpat. In the mean time you could assign an unused service account with only the Storage.ObjectViewer IAM role until the bug is fixed. This is not a workaround given that you're left with a single assignment, but it does remove Owner roles from the policy. I'll update this bug with an update when it's fixed. |
Thanks @frankyn, appreciate your efforts. |
@ep-tpat, could try removing all IAM roles from the bucket policy again? The should fix should be available now. |
It works perfectly...thanks @frankyn! |
Great to know. Please let us know if there are any more problems. |
Was this fixed? I am having a similar issue with the Google Java API. I have already opened an issue for it here. |
Please reference Issue #1210, as I was asked to open a new ticket here
In which file did you encounter the issue?
python-docs-samples/storage/cloud-client/iam.py
Did you change the file? If so, how?
No
Describe the issue
I'm trying to create a script that will remove all permissions on a bucket. The issue I'm running into is when trying to run the code below when it is the last permission/member assigned to the bucket. I have the traceback below, which is pointing to the "bucket.set_iam_policy(policy)". It seems the function errors out when there is no permission/member left when trying to set the policy. Is there a fix for this?
Failure:
The text was updated successfully, but these errors were encountered: