What are Resource Policies?
Resource Policies provide fine-grained access control at the resource level. Unlike role-based permissions that apply broadly, policies target specific resources or collections with precise allow/deny rules. Policies are evaluated before role-based permissions, giving you a powerful override mechanism.Policy Properties
A resource policy has no
name or description field. If you send them they are
silently dropped (don’t rely on them). Express intent with priority, target, and
conditions.Policy Targets
Target a Specific Resource
Target a Collection
Creating Policies
Allow Policy on a Resource
Deny Policy on a Collection
Policy with Context Condition
Policy Effects
Allow
Grants access if the policy matches:Deny
Blocks access if the policy matches. Deny policies typically have higher priority:Priority and Evaluation Order
Policies resolve by priority group, not first-match:- All matching policies (action matches, temporal window active, subject/context conditions pass) are collected.
- Only the highest-priority group among the matches decides.
- Within that group,
denybeatsallow(deny-overrides)—it is not “first match wins”. - If no policy matches, role-based permissions are checked.
deny does not override a higher-priority allow: priority selects the group, and deny wins only within the winning group.
Subject Conditions
Match based on the actor making the request:Context Conditions
Match based on request context:Combined Conditions
Use both subject and context conditions:Evaluation Flow
WhenBedrockEngine.evaluate() is called:
Decision Output
When a policy decides the outcome:Common Patterns
Owner-Only Access
resource.ownerId is not exposed in the condition context (see the roadmap), so a policy condition can’t compare it to the actor. For owner-based access today, use a resource-ownership grant (owns(subject, resource, role)) instead of a policy, or surface the owner’s subject id as a resource tag and match tags.<identifier>.
Deny All Except Admins
Temporary Access Window
Geographic Restrictions
Best Practices
Use deny policies sparingly
Use deny policies sparingly
Prefer allow policies with specific conditions. Deny policies can be hard to debug.
Set appropriate priorities
Set appropriate priorities
Use a consistent priority scheme. Example: deny=100+, allow=50, default=0.
Test policies thoroughly
Test policies thoroughly
Verify both allow and deny cases before deploying.
Document policy intent
Document policy intent
Use clear names and descriptions explaining why the policy exists.
Prefer collections over individual resources
Prefer collections over individual resources
Policies on collections are more maintainable than many individual resource policies.
Related Concepts
Resource Collections
Define dynamic resource groups for policies
Conditional Permissions
JSON Logic conditions on role-based permissions
Evaluation
How policies fit into the evaluation flow