This question has been asked previously but there’s not been a good answer on this.
Google creates default service accounts that have storage.objects.get on all buckets
- Cloud Run
- Vertex AI
- Container Registry
- Compute Engine
It seems it’s not possible to revoke these permissions. Any of those accounts could potentially be used to gain access to the data in the bucket.
Some real examples of how that would be a problem:
Or as a more simple example, if you enable the Agent Platform API and grant a user roles/aiplatform.user any training jobs you create will have access to all data in all buckets in your project through the automatically created AI Platform Service Agent. The scope for accidental exposure of data is huge.
It seems crazy that it’s not possible to create a bucket where only specific named accounts can access. We have a bucket with sensitive data in it and we absolutely don’t want other services such as Cloudbuild or Vertex AI to read from it.
As a solution we implemented DENY rules to prevent access other than from named accounts.
{
"displayName": "Block storage object access project-wide",
"kind": "DenyPolicy",
"name": "policies/cloudresourcemanager.googleapis.com%2Fprojects%2F000000000000/denypolicies/restrict-bucket-access",
"rules": [
{
"denyRule": {
"deniedPermissions": [
"storage.googleapis.com/objects.create",
"storage.googleapis.com/objects.delete",
"storage.googleapis.com/objects.get",
"storage.googleapis.com/objects.list",
"storage.googleapis.com/objects.update"
],
"deniedPrincipals": [
"principalSet://goog/public:all"
],
"exceptionPrincipals": [
"principal://iam.googleapis.com/projects/-/serviceAccounts/backend@my-project.iam.gserviceaccount.com",
"principal://iam.googleapis.com/projects/-/serviceAccounts/p000000000000-siq4mq@gcp-sa-cloud-sql.iam.gserviceaccount.com",
"principal://iam.googleapis.com/projects/-/serviceAccounts/backup-replicator@my-project.iam.gserviceaccount.com",
"principal://iam.googleapis.com/projects/-/serviceAccounts/db-backup-workflow@my-project.iam.gserviceaccount.com",
"principal://iam.googleapis.com/projects/-/serviceAccounts/backup-clone@my-project.iam.gserviceaccount.com",
"principal://iam.googleapis.com/projects/-/serviceAccounts/backup-restore@my-project.iam.gserviceaccount.com",
"principal://goog/subject/user@company.com"
]
},
"description": "Deny storage access to all buckets except for authorised service accounts"
}
],
}
I’m really surprised that this doesn’t seem to be addressed anywhere, and that this isn’t recommended practice. Is there no official answer to this?
K