> your AI agent picks dependencies from memory; give it dated facts — try starlog.dev ↗ vet your agent's deps ↗ vibe-coding is fine. vibe-importing isn’t. — try starlog.dev ↗ vibe-importing isn’t fine ↗ your agent has never seen your private packages — try starlog.dev ↗ facts for private packages ↗ a linter for the dependencies your AI agent picks — try starlog.dev ↗ a linter for agent deps ↗ whois is redacted, cdns mask the rest — get the real operator — try whoisgeni.us ↗ who really runs that domain ↗ domain attribution that shows its work — full evidence chain — try whoisgeni.us ↗ domain intel w/ evidence ↗

← Back to Articles

Cedar: Amazon's Authorization Engine That Proves Your Policies Can't Break

[ View on GitHub ]

Cedar: Amazon's Authorization Engine That Proves Your Policies Can't Break

Hook

Most authorization bugs aren't caught by tests—they're logical contradictions hiding in policy interactions. Cedar uses automated theorem provers to find them before your first deploy.

Context

Authorization logic is where security meets complexity. A typical enterprise application might have hundreds of policies governing who can access what, and as these policies accumulate, subtle interactions create vulnerabilities. Can an intern approve their own expense report by joining the right groups? Can a contractor escalate privileges through a chain of role assignments? Traditional policy engines like Open Policy Agent evaluate these rules efficiently, but they can't tell you whether your policy set contains logical contradictions or unintended privilege escalation paths.

Cedar emerged from Amazon's experience running authorization at scale across AWS services. When you're managing permissions for millions of users across thousands of resource types, two problems dominate: evaluation latency (authorization checks happen on every API call) and correctness (a policy bug can expose customer data or brick a service). Amazon's IAM policies demonstrated that a declarative policy language could scale, but IAM lacked formal verification and had inconsistent semantics across services. Cedar is the distilled lesson: a policy language designed from the ground up to be both fast and provably correct, extracted from AWS and open-sourced as a standalone Rust library.

Technical Insight

Verification Pipeline

AST

AST

Logical Formulas

Proof Results

Filtered Policies

Transitive Closure

Allow/Deny/Unknown

Encoded Formulas

DSL Parser

Static Validator

Policy Evaluator

Schema Definition

SMT Solver Z3

Policy Set Index

Entity Hierarchy DAG

Authorization Request

Authorization Decision

Symbolic Compiler

System architecture — auto-generated

Cedar's architecture revolves around a deceptively simple principle: if you constrain expressiveness enough, you can prove properties about your policies mathematically. The language intentionally omits recursion, custom functions, and I/O operations. What remains is a strictly typed expression language that's powerful enough for complex authorization but constrained enough for automated reasoning.

A Cedar policy looks like this:

permit(
  principal in Group::"engineering",
  action == Action::"ReadDocument",
  resource in Folder::"projects"
)
when {
  resource.classification == "internal" &&
  principal.clearanceLevel >= 2
};

The when clause is where Cedar's type system shines. Unlike OPA Rego, which allows arbitrary computation, Cedar's expressions are limited to comparisons, set operations, and attribute access. This limitation is the linchpin: because expressions can't execute arbitrary code, the validator can translate policies into logical formulas and feed them to an SMT solver like Z3. When you run cedar validate, it's not just checking syntax—it's constructing a mathematical model of your authorization logic and searching for contradictions.

The partial evaluation model handles a problem that plagues distributed systems: missing attributes. In a microservice architecture, fetching every attribute for every authorization decision is expensive. Cedar allows policies to return three verdicts: allow, deny, or unknown. If a policy requires resource.owner but that attribute isn't provided, Cedar returns unknown rather than failing. Your application layer decides whether unknown means deny (fail-secure) or triggers an attribute fetch:

let request = Request::new(
    EntityUid::from_str("User::\"alice\"").unwrap(),
    EntityUid::from_str("Action::ReadDocument").unwrap(),
    EntityUid::from_str("Document::123").unwrap(),
    Context::empty(),
);

let response = authorizer.is_authorized(&request, &policies, &entities);

match response.decision() {
    Decision::Allow => println!("Authorized"),
    Decision::Deny => println!("Forbidden"),
}

// Check if the decision was based on incomplete information
if !response.diagnostics().reason().is_empty() {
    println!("Reasons: {:?}", response.diagnostics().reason());
}

The entity model treats principals and resources uniformly as typed entities in a hierarchy. A User entity might be a member of multiple Group entities, and groups can contain other groups. Cedar pre-computes transitive closures of these hierarchies, so checking principal in Group::"admins" is O(1) even if group membership involves multiple hops. Entities are defined with attributes and parents:

{
  "uid": {"type": "User", "id": "alice"},
  "attrs": {
    "department": "engineering",
    "clearanceLevel": 3
  },
  "parents": [
    {"type": "Group", "id": "engineers"},
    {"type": "Group", "id": "us-employees"}
  ]
}

Cedar's killer feature is the validator's ability to prove policy properties. You define a schema that describes your entity types, actions, and what attributes exist. The validator then checks whether your policies are well-typed and can prove statements like "no policy allows Action::Delete on Resource::CriticalSystem for any principal." When it finds a violation, it provides a concrete counterexample showing exactly which entity and policy combination violates the property. This is formal verification brought to the authorization layer—the same techniques used to verify cryptographic protocols or hardware designs, applied to policy logic.

The policy indexing strategy is what makes Cedar fast enough for production. Rather than evaluating every policy on every request, Cedar indexes policies by the principal, action, and resource patterns they match. When a request comes in for User::"alice" performing Action::ReadDocument on Document::123, Cedar only evaluates policies whose principal pattern could match User entities, whose action matches ReadDocument, and whose resource pattern matches Document entities. In a policy set with thousands of policies, this typically reduces evaluation to dozens of candidates. Combined with Rust's zero-cost abstractions and arena allocation for AST nodes, Cedar consistently achieves sub-millisecond authorization decisions.

Gotcha

Cedar's biggest limitation is its static worldview. Policies must be known at deployment time, and the entity hierarchy must be materialized before evaluation. This works beautifully for systems where organizational structure changes slowly—employees join groups, resources are organized into folders—but struggles with dynamic scenarios. If you're building a multi-tenant SaaS where each customer defines custom roles and permissions, Cedar's template system (which allows slot-filling in policies) feels inadequate. You'll end up generating thousands of concrete policies from templates, which bloats policy sets and slows validation.

The entity model's requirement to pre-materialize all relationships becomes painful at scale. If you have millions of users and complex group hierarchies that change frequently, keeping Cedar's entity store synchronized with your source of truth (Active Directory, a database) introduces latency and consistency challenges. Cedar has no built-in cache invalidation or incremental update mechanism—you typically rebuild the entire entity set on changes. For systems where permissions derive from real-time data (a user can access a document if they commented on it in the last hour), Cedar forces you to pre-compute these derived attributes in application code rather than expressing them naturally in policies. The deliberately limited expression language, while enabling verification, makes certain authorization patterns awkward to express.

Verdict

Use if: You're building authorization for a regulated system where audit and correctness matter more than iteration speed, you have complex policies that interact in non-obvious ways and need formal verification to sleep at night, or you're operating at scale where sub-millisecond authorization latency directly impacts user experience. Cedar excels when your authorization model is complex but relatively stable, and when the cost of an authorization bug (data breach, compliance violation, service outage) justifies the upfront investment in schemas and entity modeling. Skip if: You need dynamic policy generation where tenants define their own authorization rules, your authorization logic requires calling external services or performing computations that don't fit Cedar's expression language, you're in early-stage rapid iteration mode where authorization requirements change weekly, or you need rich ecosystem integration with tools like Kubernetes or service meshes. For those cases, Open Policy Agent's flexibility or SpiceDB's relationship-focused model will serve you better. Cedar is optimized for mature systems where authorization complexity has crossed the threshold where informal reasoning about policy interactions becomes impossible.