Request admission and scope resolution¶
Four questions are answered before a capability acts on a request: who is calling, which scope the call is in, whether the actor may perform the action, and whether the request satisfies the capability's own admission rules. They are answered in that order, and a refusal names the step that produced it.
The order¶
flowchart TB
A["Who is calling<br/>actor resolved at the middleware"]
B["Which scope<br/>workspace UUID from the request"]
C["May they do this<br/>action authorised against roles"]
D["Is the request admissible<br/>capability validation and gates"]
A --> B --> C --> D
Each step has a different failure, and they are worth telling apart:
a 401 came from step one, a scope refusal from step two, a 403 from step
three, and a domain error with a reason from step four.
Where each step sits¶
flowchart LR
IN["Request"]
subgraph SRV["API SERVER"]
direction TB
subgraph EDGE["Middleware, every route"]
direction TB
S1{{"1 Actor<br/>refuses 401"}}
end
subgraph OWN["The owning service capability"]
direction TB
S2{{"2 Scope<br/>refuses by scope"}}
S3{{"3 RBAC<br/>refuses 403"}}
S4{{"4 Admission<br/>refuses with a domain reason"}}
S2 --> S3 --> S4
end
S1 --> S2
end
subgraph ST["STORE"]
direction TB
WS[("Workspaces")]
RB[("Roles and bindings")]
end
IN --> S1
S2 -.-> WS
S3 -.-> RB
Only the first check is shared by every route. The other three run inside the
service capability that owns the action, and the two dotted edges are the
records they read, so a scope or 403 refusal is explained by those two
records as they stood at the time of the request.
Identity is resolved once¶
The actor is resolved from the authorization header by middleware, before
routing. A bearer token that fails to resolve ends the request at the edge with
401 and the rejection reason. Everything downstream reads the resolved actor
from the request rather than re-reading the header, so one request has one
identity.
Scope arrives as a UUID¶
By the time a request reaches the control plane it carries UUIDs. Names were resolved by the caller before the call, at a single resolution point, so the API layer matches identifiers rather than interpreting names. See The name/UUID boundary across planes.
The workspace is the scope for most actions, and the organization is derived from it rather than passed alongside it. An action scoped to an organization is authorised against that organization directly.
Authorisation is per action¶
Permission is decided against the action the request names, in the scope it resolved. Roles are collected for the actor and for each group it belongs to, at both the workspace and the organization level, and combined before the action is checked. An actor holding no role in the scope is refused.
Two behaviours are worth knowing before they surprise you:
organization.createis available to any authenticated actor, because creating the first organization precedes holding a role in one.- A
systemactor is authorised only when the auth context marks the caller a system principal.
See RBAC evaluation for the roles and what each one permits.
Capability admission is the fourth step¶
Passing authorisation means the actor may attempt the action. Whether this particular request is admissible is decided by the capability, and this is where governance gates run: manifest, package, flow, policy, execution and mutability admission each refuse with their own reason.
The mutability gate is the one most often met, because it enforces that a published version is final:
See Governance and admission for the gates and what each admits.
Reading a refusal¶
| Symptom | Produced by | Means |
|---|---|---|
401 with auth_context.rejected |
The auth middleware | The token did not resolve |
403 on an action name |
Authorisation | The actor holds no role granting that action in the scope |
| Not found for a name you can see | Scope resolution at the caller | The active context resolved a different organization |
A domain reason with a 4xx |
The owning capability | The request was authorised and then refused on its content |
The last row is worth separating from the rest. A status code is the transport's answer and says which class of failure occurred; a domain reason is the owning capability's answer and says what it decided. When both are present, the reason is the one that identifies the decision, and the capability that owns the action is the one that produced it.
A refusal carrying only a status and no reason came from the edge, before any capability saw the request. A refusal carrying a reason came from the authority that owns the action named in it.