Scope-based authorization. The capability model with two axes: roles (ceiling) and scopes (floor).
required.all? { |s| held.include?(s) }
The caller must hold every required scope. Having :read but missing :sign when both are required is a denial. Any gap raises Authorization::Denied with both lists for audit.
Every authorization check — granted or denied — is recorded on the active trace span.
A site defines each access level once, under auth.levels. A level lists its callers by group, by client and by subject. A route names the level that it requires with the access key. A route with no access key is open.
auth:
levels:
platform:
groups: [wisp-users]
clients: [up]
subjects:
- system:serviceaccount:drive:advaita-drive
- !Env { name: WISP_SUBJECT_QUEEN, default: "" }
routes:
/submit:
method: post
access: platform
The core injects require_identity on every route with by_route: true and levels: !UserConfig auth.levels (runtime.yml, core_injections). It runs directly after auth_verify, and reads the identity that auth_verify verified.
| Request | Answer |
|---|---|
The route has no access, or an empty one. |
The request passes. |
The route names a level that auth.levels does not define. |
HTTP 500. |
| The request has no verified identity. | HTTP 401. |
| The identity is in none of the lists of the level. | HTTP 403. The error names the level. |
| The identity is in one list of the level. | The request passes. The crossing carries identity and level. |
| List | It matches |
|---|---|
groups |
A group in the token claims: groups (with a leading / removed) or realm_access.roles. |
clients |
The azp claim of the token, the Keycloak client that the caller signed in as. |
subjects |
The sub of a token from a trusted issuer (auth.trusted_issuers), a machine identity. A token from the primary issuer never matches a subject. |
Each list is an array or a comma string. The check removes empty values, so an !Env that is not set matches no caller. An access value can be an !Env. The value resolves when the config loads.
The POST /poke/*addr route keeps its own require_identity slot without by_route. That slot requires any verified identity, or auth.open_poke: true.
Source: lib/wanderland/boundaries/auth/require_identity.rb. Spec: spec/wanderland/route_access_spec.rb.
The engine marks each routed request. Peek and poke set the principal of the request from the verified identity. A boundary that reads or writes storage itself, outside peek and poke, runs with no principal. This document calls such a request an unattributed request.
| Caller | :pki: and :identities: |
Every other tree |
|---|---|---|
| A request with a principal. | The registry refuses each read and write. | The access entry of the address applies. |
| An unattributed request. | A read finds nothing, and a write raises StorageAccess::Denied. |
The registry does not check access. |
Code under Principal.system. |
The registry does not check access. | The registry does not check access. |
| Code outside a request, such as boot or a schedule. | The registry does not check access. | The registry does not check access. |
Code that needs a key or an identity during a request runs that read under Principal.system. A list read in an unattributed request drops each row under :pki: or :identities:.
A storage mount declares its access: one level for the whole mount, or a map from an address key to a level. The registry finds the entry for an address with access_for. The store checks each read and each write that a request makes against that entry.
| Level | Who reads or writes |
|---|---|
restricted |
No request. Only the process itself. |
authenticated |
A request with a verified identity. An entry can also name the groups that the identity must hold. |
open |
Any request. |
| Rule | Meaning |
|---|---|
| A key is a prefix | The key :plans: reaches every address that starts with :plans:. |
A * segment |
A * in a key stands for exactly one address segment, with no colon. The key :plans:*:runs:*:cancel reaches the cancel record of every run, and no other record of a run. |
| The longest key wins | When more than one key reaches an address, the entry of the longest key applies. |
The * key |
The key * alone is the default of the map. It applies when no other key reaches the address. |
| Always restricted | The registry restricts :pki: and :identities:, whatever a mount declares. |
| No access declared | A mount with no access is open. |
wanderland-core/lib/wanderland/authorization.rb
wanderland.dev