Records Architecture decision

ADR-040

Permission-Only RBAC with Owner Override

Partially superseded Decided 2026-06-15 Source file

Amended 2026-08-11: Configured owner emails now converge on the durable owner role instead of acting as a separate permission-time fallback. This keeps live authorization and current notification visibility on one representation.

Amended 2026-08-28: Permission identifiers are opaque, stable values. Current identifiers use domain.capability or domain.capability-with-qualifier. The permission catalog defines each inclusion directly. Identifier punctuation does not define authority.

Amended 2026-09-01: ADR-087 replaces the authorization fence with stable request-time authorization and aggregate OCC. The RBAC resolution rules in this record remain current.

Amended 2026-09-25: ADR-105 makes the effective-owner override effective only while the owner's session has active privileged mode. Owners stay entitled to all permissions.

Partially superseded by ADR-052. The effective-owner override, permission-only gates, and non-ranking role positions remain active. ADR-052 replaces the literal all-subject, all-scope deny-wins combination rule.

Context

Chatto's earlier RBAC resolver used role position as part of authorization: higher-ranked role decisions could override lower-ranked decisions, and many targeted operations required both a permission and a strict actor-vs-target rank comparison. That model fit the older multi-space design, but it became hard to explain and easy to misapply in the current single-server model.

The main pressure points were:

  • operators had to understand when rank affected capability and when it only affected display order;
  • direct per-user permission editing was coupled to role-management concepts;
  • announcement rooms depended on hierarchy behavior instead of a simple local exception to broad member defaults;
  • owners could be locked out by unusual RBAC configuration unless runtime code treated effective owners specially.

Decision

Use a permission-only RBAC model for everyone except effective owners.

  • Effective owners are users with the durable owner role. A verified email matching owners.emails is materialized into that role at boot and through a retryable durable worker after verification; verification waits for the materialization before reporting success. Owners are always granted all permissions regardless of stored allow/deny state.
  • Every other role, including admin, confers only its explicit permission decisions. Runtime code does not attach additional authority to role names.
  • For non-owners, permission resolution is deny-wins: any applicable user or role deny blocks the permission; otherwise any applicable allow grants it; otherwise the result is no decision and the API treats it as denied.
  • Role position remains as ordering/display metadata and for compatibility with existing role events. It is not an authorization rank.
  • Targeted operations are gated by concrete permissions only: for example role.assign gates role assignment, user.manage-accounts gates account lifecycle and recovery actions, room.remove-member gates moderated room removal and suspension, and user.manage-permissions gates direct per-user permission overrides.
  • Authorization-sensitive writes normally evaluate permission checks inside their target aggregate's OCC retry. RBAC, relevant user lifecycle, and room-group/layout changes advance a narrow durable authorization fence atomically with their domain facts. Message posts and authorized edits check that fence without advancing it, so a concurrent classified authority change reruns their complete decision. Reactions and message retractions use room OCC with request-time authorization and accept eventual consistency for a cross-aggregate revocation already in flight.
  • Default channel-room member permissions are granted at server scope on everyone, so normal rooms work immediately. Room and group decisions are local exceptions; the built-in announcements room adds a room-level everyone deny for message.post.
  • Permission identifiers are opaque, stable values. Their punctuation has no authorization meaning. The permission catalog defines inclusion explicitly. For example, the catalog states that message.read includes message.read-interactions directly.
  • An effective message.read allow satisfies message.read-interactions. An interaction-scoped allow does not grant broad reads. A narrow deny cannot restrict an effective broad allow. A broad deny does not restrict a separate interaction-scoped allow.

This supersedes ADR-005.

Consequences

  • The authorization model is easier to reason about: owners are special and everyone else is permission-based.
  • Custom roles and per-user overrides cover ordinary moderation and administration cases without role-rank comparisons.
  • #announcements works by a local room-level everyone deny for message.post. Because deny-wins is literal, that deny blocks every non-owner in the room.
  • Deny-wins enables future broad restriction roles such as a suspended role.
  • Operators cannot revoke the durable owner role while its verified email remains in owners.emails. Existing matching users are repaired at boot and new verifications are repaired by durable redelivery, so protecting the configuration and verified-email ownership remains security-critical.
  • Existing role position fields and protobuf event fields remain for compatibility. Removing or reserving them can be considered separately if the persisted event contract is migrated.
  • Permission inclusion changes effective authorization only. It does not write or synthesize an additional RBAC grant.
  • A new permission does not change other permissions by its name alone. An explicit catalog relationship can change authority. Catalog validation rejects unknown targets, self-inclusion, and incompatible categories or scopes.
  • The authorization fence adds an empty operational fact to protected batches. During a mixed-version rollout, its full concurrency guarantee starts only after all writing replicas understand and advance the fence.
  • An authorized message edit cannot commit across a classified role or permission change that advanced the authorization fence after its decision. Unrelated EVT traffic does not contend. An in-flight reaction or message retraction can still commit before the serving replica projects a cross-aggregate revocation; room membership and lifecycle changes remain room-OCC guarded.

Records that name this record

Esc