Skip to content

0001. Authorisation model: gate, resource check, grants as a ceiling ​

Status: accepted. Applies to crates/kernel (bus) and crates/authz (Cedar).

Context ​

Every command and query goes through the bus and is authorised by Cedar. The input of a request is untrusted: it can name any record, and it cannot prove who owns that record. People act through a role in a tenant (owner, admin, member). API clients and agents act through per-action grants. The System actor runs platform jobs.

Decision ​

  1. Two checks per request.

    • Gate. Before the handler runs, the bus asks Cedar whether the actor may run the action at all. The resource is the tenant (resource is Tenant). Actors without a membership in the request's tenant are denied before Cedar runs. Unknown tenants get the same denial.
    • Resource check. The handler loads what it acts on and calls ctx.authorize(&ResourceRef), which is evaluated with resource is Resource (kind, tenant, owner). The bus refuses to commit a handler that never made this check, unless the handler declares TENANT_SCOPED = true (it acts on the tenant as a whole, so the gate is the whole decision).
  2. Grants are action-level, and they are a ceiling. A grant lets a client or agent pass the gate for that action. Base forbid policies deny any action outside a client's or agent's grants, whatever a module permits. Module permits must scope their principal. The loader rejects an unconstrained principal, a bare principal is ApiClient or principal is Agent without a condition, and principal is System. The system principal is named explicitly (principal == System::"system").

  3. Clients and agents need explicit resource policies. A grant opens the gate only. At the resource level a client or agent is allowed only where a module policy names that principal type for that resource kind. A grant for sample.note.edit does not let a client edit someone else's note.

  4. Sensitive actions need confirmation from agents, API clients and anyone using the MCP door. context.confirmed is true only when the MCP door dispatched the attempt after redeeming its one-time confirmation (Bus::dispatch_json_confirmed, refused for any other door); it is recorded on every audit entry. What that step does and does not prove is in ADR 0003.

  5. context.door is only trustworthy as "mcp" or not "mcp". The cli label is declared by the client (a header on the GraphQL endpoint), so policies must never compare context.door to anything but "mcp".

  6. Managers are row-level only. A Resource may carry manager (the person its owner reports to, set by the handler from the loaded row with ResourceRef::managed_by), so a module can let managers act on or read their reports' records. A Field never carries it: the schema has no manager on Field and orbit_pii clears it before a field check, so a field policy reading resource.manager fails validation at startup (and resource has manager is always false on a field). Giving managers any personal field needs its own ADR.

Consequences ​

  • A forgotten resource check fails at runtime and in the allow/deny harness, not silently.
  • Module authors write two kinds of policy: gate policies (who may attempt) and resource policies (on what). The loader enforces the scoping rules above at startup.
  • Clients and agents start with no resource access in a module until that module opts in.

Future ​

MCP agents acting for a person will carry on_behalf_of. Their effective access will be the intersection of the person's role-based permissions and the agent's grants. This will be modelled as an extra principal attribute and a base ceiling, not as a widened grant.

Orbit by SkySync Tech. Licensed under AGPL-3.0.