An experiment from the lab Back home

Who can open this?

A permission is a question with three parts: who, what, and which one.

Six people. Six requests. One set of rules.
PersonView issue 101Lift stuck, Dublin OfficesEdit issue 101Reported by AliceEdit issue 103Reported by Dave, Cork ApartmentsApprove inspection 201Written by DaveApprove inspection 202Written by AliceMake Dave a building adminAt Dublin Offices
AliceBuilding admin at Dublin Offices. Viewer at Cork Apartments.
BobBuilding admin at Galway Studios, in another company.
CarolAdmin of Liffey Estates, which owns Dublin and Cork.
DaveInspector at Dublin Offices. Reporter at Cork Apartments.
NoraHas an account. No roles anywhere.
RaviWas a viewer at Galway Studios. Revoked.
Change the facts and the rules

Alice · Approve inspection 202. Denied by forbid-self-approval. A forbid wins over any permit.

// forbid-self-approval.cedar
// Separation of duties: nobody approves an inspection they created,
// whatever other policies permit.
forbid (principal, action == Caretaker::Action::"ApproveInspection", resource)
when { resource has createdBy && resource.createdBy == principal };
✓ allowed✕ denied by a forbid– no rule allows itLoading the Cedar engine…

What you’re seeing

Each cell is one real decision. The Cedar policy engine runs in your browser with fifteen rules, six people and four buildings owned by two property companies. A tick means a rule allowed the request. A cross means a forbid rule stopped it. A dash means nothing allowed it, and in Cedar, silence means no.

One rule, many doors

Switch off the self-approval rule and Alice can approve the inspection she wrote. Make Dave an admin at Dublin Offices and several answers change at once, but he still cannot approve inspection 201, because he wrote it. A permit opens one kind of door for the people it names. A forbid closes that door for everyone, whatever roles they hold. That is the point, and that is the risk.

Where the facts come from

The rules never change between cells. Only the facts do: which roles a person holds, and who wrote what. In a real app, those facts come from the database on every request, and the engine trusts them completely.

Synthetic people, companies and buildings. The same schema and rules as the course app.