Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google cloud storage listing files in bucket requires permission for project owner

I'm currently using web UI to browse the files in one of the buckets and I happen to be the project owner as well. However I get a permission error

You need the storage.objects.list permission to list objects in this bucket. Ask a project or bucket owner to give you this permission, then try again.

I'm completely stumped as I'm project owner. Any ideas?

like image 870
opensourcegeek Avatar asked Jan 25 '18 13:01

opensourcegeek


People also ask

How do I give public access to bucket GCP?

In the Google Cloud console, go to the Cloud Storage Browser page. In the list of buckets, click on the name of the bucket that you want to make public. Select the Permissions tab near the top of the page. In the Permissions section, click the + Add button.

Does not have storage objects create access to the Google Cloud Storage bucket forbidden?

The error you get means that your Cloud Function service account is lacking the storage. objects. create permission. In order to fix it, you can either give your service account a predefined role like Storage Object Creator or create a custom role with that permission.

What GCP Tool is used to control access to a Cloud Storage bucket?

In most cases, IAM is the recommended method for controlling access to your resources. IAM controls permissioning throughout Google Cloud and allows you to grant permissions at the bucket and project levels.


2 Answers

The role roles/owner doesn't grant access to data within buckets.

The best resource to figure out which built-in IAM roles can do which things is the Google Cloud Platform IAM Permissions Reference.

On that page, CTRL-F for storage.objects.list (or for that matter, any other permission you're interested in) and you will see the roles that grant it on the right-hand column. Note that project owner (roles/owner) is not in the list of roles that grant this permission.

When buckets are created, roles/storage.legacyBucketOwner is granted to project owners, editors, and viewers by default. However, this permission can always be revoked, and in fact many users choose to remove this permission for more granular control over access to data in the bucket as opposed to project resources like VMs.

A good example would be a bucket which contains sensitive PII data. You might not want people who can SSH into VMs in the project to be in-scope to read that data.

like image 178
Dom Zippilli Avatar answered Oct 31 '22 04:10

Dom Zippilli


In the GCP Console navigate to the IAM Admin menu.

  1. Choose IAM (top menu item)

Select your account.

In the info panel click on Add Role

Add the Storage Object Admin role to your account

  1. Choose Service Accounts menu item from the IAM menu (below Quotas)

Select the [email protected] or default account.

In the info panel click on Add Member and add your account.

You should now have full access to the Storage Bucket

like image 23
R3N13R Avatar answered Oct 31 '22 06:10

R3N13R