Cloud Storage Buckets configured with anonymous or public access pose significant security risks by allowing anyone on the internet to access potentially sensitive data. Including allUsers in IAM bindings grants access to anyone, while allAuthenticatedUsers grants access to any Google account holder. Both violate the principle of least privilege.
Insecure configuration example:
resource "google_storage_bucket_iam_binding" "insecure" {
bucket = google_storage_bucket.default.name
role = "roles/storage.admin"
members = ["user:jane@example.com", "allUsers"]
}
Secure configuration example:
resource "google_storage_bucket_iam_binding" "secure" {
bucket = google_storage_bucket.default.name
role = "roles/storage.admin"
members = ["user:jane@example.com"]
}
Compliant Code Examples
#this code is a correct code for which the query should not find any result
resource"google_storage_bucket_iam_binding""negative1"{bucket=google_storage_bucket.default.namerole="roles/storage.admin"members=["user:jane@example.com",]}
Non-Compliant Code Examples
#this is a problematic code where the query should report a result(s)
resource"google_storage_bucket_iam_binding""positive1"{bucket=google_storage_bucket.default.namerole="roles/storage.admin"members=[]}resource"google_storage_bucket_iam_binding""positive2"{bucket=google_storage_bucket.default.namerole="roles/storage.admin"members=["user:jane@example.com","allUsers"]}resource"google_storage_bucket_iam_binding""positive3"{bucket=google_storage_bucket.default.namerole="roles/storage.admin"members=["user:jane@example.com","allAuthenticatedUsers"]}
1
2
rulesets:- Terraform / GCP # Rules to enforce / GCP.
맞춤형 데모 요청
Datadog 시작하기
Ask AI
AI-generated responses may be inaccurate. Verify important info.