Cedar Policy Examples
This page contains all the Cedar policies used in the demo scenarios. Each policy demonstrates different authorization patterns and Cedar language features.Demo Scenario Policies
These policies correspond to the five acts in the live demo. You can copy and paste them directly into your AVP Policy Store.Act 1: Zero Trust Default Deny
In Act 1, we demonstrate Zero Trust by showing that Alice is denied access even with valid credentials when no policies exist.No policies yet! This act demonstrates that AVP denies by default. Without any permit policies, all access requests return DENY.
- Principal: Alice Garcia (Analyst, Finance)
- Action: Read
- Resource: Q4-Report-2024 (Finance, confidential)
- Result: 🚫 DENY (no matching policies)
Act 2: Basic RBAC with Department Check
This policy enables Analysts to read documents, but only within their own department.- Cedar Policy
- Explanation
- Test Cases
- Code Reference
Act 3: Cross-Department Access for Auditors
Auditors need to read documents across all departments for compliance purposes.- Cedar Policy
- Explanation
- Test Cases
- Combined Effect
Act 4: Forbid Critical Actions
Even Auditors shouldn’t be able to modify or delete documents. Forbid policies enforce this.- Cedar Policy
- Explanation
- Test Cases
- Precedence
Additional Policy Patterns
Here are more Cedar policies demonstrating advanced patterns you can use:Admin Full Access
Administrators can perform any action on any resource:actionwithout conditions matches all actionsresourcewithout conditions matches all resources- Simple but powerful for admin roles
Clearance Level Gating
Restrict access based on security clearance:Block All Deletes on Confidential Documents
Protect critical documents from deletion:principalwithout restrictions applies to all users- Even Admins cannot delete confidential documents
- Ultimate data protection for critical resources
Department-Based Edit Access
Allow editing only within your department:Time-Based Access (Concept)
While not in the current demo, Cedar can check context attributes like time:Policy Testing Matrix
Here’s a complete matrix showing which user can perform which action on which resource after all demo policies are applied:| User | Role | Document | Read | Edit | Delete |
|---|---|---|---|---|---|
| Alice | Analyst | Q4-Report-2024 (Finance) | ✅ Act 2 | 🚫 No policy | 🚫 No policy |
| Alice | Analyst | HR-Payroll-2024 (HR) | 🚫 Dept mismatch | 🚫 No policy | 🚫 No policy |
| Bob | Admin | Q4-Report-2024 (Finance) | ✅ (if admin policy added) | ✅ (if admin policy added) | ✅ (if admin policy added) |
| Bob | Admin | HR-Payroll-2024 (HR) | ✅ (if admin policy added) | ✅ (if admin policy added) | ✅ (if admin policy added) |
| Carol | Auditor | Q4-Report-2024 (Finance) | ✅ Act 3 | 🚫 Act 4 forbid | 🚫 Act 4 forbid |
| Carol | Auditor | HR-Payroll-2024 (HR) | ✅ Act 3 | 🚫 Act 4 forbid | 🚫 Act 4 forbid |
| Carol | Auditor | Sales-Dashboard (Sales) | ✅ Act 3 | 🚫 Act 4 forbid | 🚫 Act 4 forbid |
Policy Creation Tips
Name your policies descriptively
Name your policies descriptively
In the AVP console, give each policy a clear name:
- ✅
AllowAnalystReadOwnDepartment - ✅
ForbidAuditorModify - ❌
Policy1 - ❌
test-policy
Test incrementally
Test incrementally
Add one policy at a time and test it before adding the next. This makes debugging easier.
Use the AVP console policy editor
Use the AVP console policy editor
The AVP console provides syntax highlighting and validation. It will catch typos and schema violations before you save.
Start with permit, add forbid later
Start with permit, add forbid later
Get your permit policies working first. Then add forbid policies to enforce restrictions. This follows the principle of starting permissive and adding restrictions.
Use the Cedar Playground
Use the Cedar Playground
Test policies offline at cedarpolicy.com/playground before deploying to AVP.
Policy vs Code Comparison
One of the key benefits of Cedar is separating authorization from code. Here’s what the same logic would look like in code:- Cedar Policy
- Python Code
Deployment needed: No (change takes effect immediately)
Who can change: Security team via AVP console
With Cedar, you can update authorization rules without deploying code. Security teams can adjust policies in real-time through the AVP console.
Next Steps
RBAC vs ABAC
Learn the difference between role-based and attribute-based access control
Schema Definition
Review the schema that makes these policies possible
Deploy the Demo
Try these policies yourself in the live demo
Cedar Playground
Experiment with Cedar policies in your browser