A security audit finds that a company's application service accounts have been granted broad IAM roles (e.g., Storage Admin on the entire project) when they only need to read specific Cloud Storage buckets. The auditor recommends following the principle of least privilege. What is the most precise way to implement this for the Cloud Storage use case?
Trap 1: Grant the Storage Admin role at the project level but add a…
IAM conditions can restrict by resource name or time, but starting with Storage Admin (which includes delete and create bucket permissions) and trying to narrow it is harder and more error-prone than starting with a minimal role at the resource level.
Trap 2: Create a custom IAM role that combines all permissions from all…
Starting from all permissions and removing dangerous ones is the opposite of least privilege — it's more likely to leave excessive permissions than starting from a minimal set and adding only what's needed.
Trap 3: Use the same broad Storage Admin role but rotate the service…
Key rotation reduces credential exposure time but doesn't address the core problem: the service account has far more permissions than it needs. A compromised credential within the 90-day window still has full Storage Admin access. Least privilege reduces blast radius; rotation reduces exposure duration — both are needed, but least privilege must be addressed first.
- A
Grant the Storage Admin role at the project level but add a condition that limits it to specific operations
Why wrong: IAM conditions can restrict by resource name or time, but starting with Storage Admin (which includes delete and create bucket permissions) and trying to narrow it is harder and more error-prone than starting with a minimal role at the resource level.
- B
Grant Storage Object Viewer (read-only) at the specific bucket level for each service account that needs read access — not at the project level
This is the most precise least-privilege implementation. Storage Object Viewer grants read access to objects within a bucket. Binding it at the bucket level (not project) means the service account can only read from that specific bucket — not create buckets, not access other buckets, not delete objects. This minimizes blast radius if the service account is compromised.
- C
Create a custom IAM role that combines all permissions from all predefined roles but removes the most dangerous ones
Why wrong: Starting from all permissions and removing dangerous ones is the opposite of least privilege — it's more likely to leave excessive permissions than starting from a minimal set and adding only what's needed.
- D
Use the same broad Storage Admin role but rotate the service account key every 90 days to reduce the window of exposure
Why wrong: Key rotation reduces credential exposure time but doesn't address the core problem: the service account has far more permissions than it needs. A compromised credential within the 90-day window still has full Storage Admin access. Least privilege reduces blast radius; rotation reduces exposure duration — both are needed, but least privilege must be addressed first.