Determine effective IAM access through the hierarchy
A bucket role is granted to a group at a folder. An engineer removes a project-level grant, yet a group member can still read objects. Why?
Determine effective IAM access through the hierarchy
Work through an employee’s effective access to a bucket by combining organization, folder, group and project bindings.
Work through the decision
A bucket role is granted to a group at a folder. An engineer removes a project-level grant, yet a group member can still read objects. Why?
Check your reasoning
The folder grant still applies to descendant resources. Inspect group membership, inherited and direct policies, conditions and applicable denies. Change the grant at the scope that actually confers the permission.
Interpret the evidence
- Inherited allow binding
- An allow binding at an ancestor can grant its permissions on descendants.
- Predefined role
- Google maintains a product-specific permission set. Review the current permissions for the work required.
- Custom role
- Bundle supported permissions into a user-managed role when no suitable predefined role meets a strict permission boundary.
- IAM condition
- A binding can restrict when or for which eligible resource the grant applies.
- Deny policy
- An applicable deny of a supported permission takes precedence over an allow, subject to configured exceptions.
Practice the guide skills
- Read the principal, role and condition in a policy binding and trace each ancestor’s grants. Check group membership and any applicable deny policies.
- Compare basic, predefined and custom roles for a specific pair of required permissions. Remove an unnecessary permission at its actual source.
- Test a proposed grant with two identities, including one outside the authorized group, and record the resource and operation for each check.
Official objectives for this lesson
Lab · trace access to its granting scope
An allow-policy review covers an organization, a folder, a project and one bucket. Run the Python 3 fixture locally. Find why editing the project alone fails to remove Mina’s read access. The fixture models unconditional allow grants and group membership.
groups = {"warehouse-readers": {"mina", "sol"}}
parents = ["org", "finance", "ledger", "receipts-bucket"]
grants = {
"finance": [("group:warehouse-readers", "read")],
"ledger": [("user:mina", "read")],
"receipts-bucket": [("user:sol", "write")],
}
def granting_scopes(user, action):
principals = {"user:" + user}
principals.update("group:" + name for name, members in groups.items()
if user in members)
return [scope for scope in parents
if any(who in principals and verb == action
for who, verb in grants.get(scope, []))]
print("Mina before:", granting_scopes("mina", "read"))
grants["ledger"] = []
print("Mina after:", granting_scopes("mina", "read"))
print("Sol write:", granting_scopes("sol", "write"))
print("Guest read:", granting_scopes("guest", "read"))
Check the result
Mina before: ['finance', 'ledger'] Mina after: ['finance'] Sol write: ['receipts-bucket'] Guest read: []
Remove Mina from warehouse-readers and rerun after the project edit. She loses the final allow path while Sol keeps the bucket grant. Real IAM expands permissions from roles and evaluates conditions, deny policies and other applicable restrictions.
Related lesson · Separate the right to run a query from the right to read data
Determine effective IAM access through the hierarchy quiz
Answer 3 questions. Check each answer for an explanation.
Worked example · Determine effective IAM access through the hierarchy