All lessons Leer en español

Security in depth · Unit 25 · Lesson 6 of 12

Resource policies need concrete scope

Compare two permission records to find why a narrow role still has a broad grant.

4 minreadyShort lesson

Helpful before thisCloud identity

See all lessons in this topic

After this lesson you can

  • Explain why one restrictive-looking grant does not cancel another applicable allow.

Find the grant that a narrow-looking role summary leaves out.

Read both sides

A resource-based policy is attached to a resource and can grant specified principals access to it. In a straightforward AWS same-account evaluation, an applicable allow from an identity or resource policy can authorize the action. A narrow allow in one document does not automatically cap another grant.

Principal and action → Resource scope → Effective permissionPrincipal and actionResource scopeEffective permission
Effective permission depends on all applicable policies, not just the shortest or narrowest-looking document.

Three records for Exporter

R1: Exporter’s role policy allows reading objects under reports/approved/.

R2: The bucket policy grants that same role object reads under reports/*, including reports/draft/forecast.csv.

R3: The owner approves only reports/approved/. Both policies and the role belong to one account.

These are simplified policy summaries. Assume valid authentication, matching conditions, satisfied encryption prerequisites, and no explicit deny, permissions boundary, session restriction, or organization restriction affecting these reads.

R2 supplies the excess allow. Under those assumptions, reading the draft is permitted by policy even though it is outside the owner’s approved purpose. R1 does not subtract R2’s permission. The wildcard also includes future object keys matching that prefix; it does not grant unrelated operations such as deletion.

A useful proposal narrows R2 to the approved prefix and checks for other grants before declaring closure. Adding another narrow allow leaves the original excess intact. If the team considers an explicit deny, it must assess which legitimate consumers that deny would also affect.

Write a review citing R2 and R3, with two acceptance expectations: the approved report remains readable and the draft is denied for Exporter. Separate policy authorization from observed use: these records establish a grant, not that anyone read the draft. Cross-account access and additional policy types need their own evaluation.

Check yourself

No timer. No penalties. Read the explanation and try again whenever you like.

  1. Which proposed change addresses Exporter’s excess access under R1-R3?

    Show the answer

    Correct answer: Narrow R2’s object scope to approved reports and review other applicable grants. R2 independently grants access to the broader reports prefix in this same-account example. Removing that excess allow addresses the supplied cause; other grants still require review.

Try it

  • WriteWrite a review of R1-R3 naming the excess grant, the narrow correction, and an approved-read and draft-read acceptance result. Explain why adding another narrow allow would not fix the supplied policy.
References