A DevOps engineer is updating an automated data pipeline script that uploads nightly log archives to a Cloud Storage bucket named `analytics-logs-prod`. The security team recently enabled Uniform Bucket-Level Access (UBLA) on this bucket to satisfy compliance requirements. Following this change, the pipeline script fails during file upload when executing `gcloud storage cp` with the `--canned-acl=bucket-owner-full-control` flag. How should the engineer resolve this pipeline failure while following Google Cloud security best practices?
- Remove the canned ACL flag from the upload command and assign the Storage Object Creator predefined IAM role to the pipeline service account.Answer
- BDisable Uniform Bucket-Level Access on the Cloud Storage bucket so that the script can continue specifying object-level ACL flags during upload.
- CGrant the primitive Owner role to the pipeline service account at the project level to bypass Uniform Bucket-Level Access restriction checks.
- DAdd a project-level IAM deny policy that revokes ACL evaluation for object uploads while retaining the canned ACL flag in the command.
Answer
Remove the canned ACL flag from the upload command and assign the Storage Object Creator predefined IAM role to the pipeline service account.
When Uniform Bucket-Level Access is enabled on a Cloud Storage bucket, individual object ACLs are ignored and specifying canned ACL parameters in CLI or SDK calls causes an API error. The recommended remediation is removing the ACL parameter from the upload command and delegating access control strictly to predefined Cloud Storage IAM roles like Storage Object Creator.
Step-by-Step Solution
Key Concept
Uniform Bucket-Level Access (UBLA) disables individual object ACLs and mandates Google Cloud IAM for all access control decisions on the bucket.