GCP Storage Bucket Uniform Bucket-Level Access needs review

Manage bucket and object access consistently through IAM.

Description

When uniform bucket-level access is disabled, both IAM and bucket or object ACLs can grant access. Enabling it disables ACLs and makes IAM the source of permissions.

Potential impact

An overlooked object ACL can expose data even after an IAM grant is removed. Applications that depend on ACLs can also lose access during a change.

Remediation

Identify users and applications that depend on ACLs, grant them the required IAM roles and test compatibility. Set uniform_bucket_level_access = true and remove ACL dependencies. For a private bucket, remove public IAM grants and consider public access prevention. Verify that required access succeeds and unwanted requests are denied.

Examples

The examples change the setting on the same bucket. Use an available, globally unique name. A domain-style name such as image-store.com requires domain ownership verification.

Before

hcl
resource "google_storage_bucket" "artifact_bucket" {
  name                         = "image-store.com"
  location                     = "EU"
  uniform_bucket_level_access  = false
}

false leaves ACLs enabled. Check both IAM and ACL grants to determine whether the bucket is public.

After

hcl
resource "google_storage_bucket" "artifact_bucket" {
  name                         = "image-store.com"
  location                     = "EU"
  uniform_bucket_level_access  = true
}

true disables ACLs on this bucket. Public IAM grants, if any, are still effective unless another control blocks them.

References