RBAC evaluation¶
Authorisation is one function of three inputs: an actor, an action, and a
scope. This page is the order it evaluates in, because a 403 is explained by
which step returned false rather than by the role table. For the roles and what
each permits, see
Roles and bindings.
The evaluation order¶
flowchart TB
A["Actor present?"]
B["System actor?<br/>allowed only as a system principal"]
C["Action is organization.create?<br/>allowed for any authenticated actor"]
D["Expand principals<br/>the actor plus each of its groups"]
E["Collect roles<br/>workspace roles and organization roles"]
F["Match the action<br/>against each role's permissions"]
A --> B --> C --> D --> E --> F
Each step can end the evaluation. Reading a refusal means finding the first one that did.
Where the roles come from¶
flowchart LR
subgraph PR["PRINCIPALS, expanded"]
direction TB
P1["the actor"]
P2["group:platform"]
P3["group:sre"]
end
subgraph ORG["ORGANIZATION"]
direction TB
OB[("Role bindings")]
subgraph WS["WORKSPACE, in scope"]
direction TB
WB[("Role bindings")]
end
end
RS[("Combined role set")]
M{{"Match the action"}}
PR --> OB
PR --> WB
OB --> RS
WB --> RS
RS --> M
Every principal is looked up in both boxes, and the results are pooled before
the action is matched. A 403 means no role in the pool permits the action,
whichever box each role came from.
Three short-circuits before roles are read¶
An empty actor is refused. No identity means no permissions, and the evaluation stops before any lookup.
A system actor is decided by context. Where the actor is system, the
request is allowed only when the auth context marks the caller a system
principal. A system actor with no such context is refused rather than
inheriting privilege from the name.
organization.create is allowed for any authenticated actor. Creating an
organization precedes holding a role in one, so this action is decided before
roles are consulted.
Principals are expanded before lookup¶
The actor and its groups are all principals, and roles are collected for each:
alice@example.com the actor
group:platform a group from the token or the mapping layer
group:sre a group from the token or the mapping layer
A group name without the group: prefix is given one, so a binding to a group
is distinguishable from a binding to an actor of the same name. Duplicate
principals are collapsed before lookup.
Roles come from two levels and combine¶
For every principal, roles are collected at the workspace and at the organization that workspace belongs to. All of them are combined into one set, deduplicated, before the action is matched.
Two consequences follow, and they are the ones most often met:
- Access granted at the organization level applies inside every workspace in it, without a per-workspace binding.
- A principal's most permissive role wins, because the action is matched against the combined set rather than against a single resolved role.
An empty role set is a refusal¶
A principal set that collects no roles at either level is refused immediately. The action is matched against an empty set, and no default role is assumed.
A newly mapped group therefore grants nothing until a binding names it: the identity resolves, the groups resolve, and the role collection comes back empty.
Matching the action¶
Each collected role is looked up, and the action is allowed when any role
carries * or names the action exactly. Matching is exact: an unrecognised
role name resolves to an empty permission set and contributes nothing, rather
than failing the evaluation.
Organization-scoped actions are evaluated the same way against the organization directly, rather than through a workspace.