Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Engine reference — generated from the canonical engineering source. Do not edit this page by hand.

RBAC Permission Scopes — Server-Side Reference

This is the canonical reference for Sol’s server-side permission scopes: the verb:resource strings enforced by the auth middleware (server/src/sol_auth_middleware.erl), the ownership-check layer beneath them, and the tasks:execute dispatch-plane grant. It documents the wire level authorization vocabulary — the client-side permission modes (default, allow-all, deny-all, read-only, plan, auto) are a different system and are covered in permissions.md.

All rows are code-verified against the current tree. The single source of truth is the exported sol_auth_middleware:test_get_endpoint_permissions/0 (the ?ENDPOINT_PERMISSIONS table) plus ?RESOURCE_SCOPES; this document is a rendered view, not an authority. The shipped table is pinned behaviorally by sol_auth_middleware_rbac_permissions_tests and the route/permission gates (ci/route_permission_lint.py, ci/rbac_route_matrix_lint.py, ci/mutation_verb_scope_lint.py).

Authorization pipeline (one request)

Middleware chain: [cowboy_router, sol_auth_middleware, sol_log_middleware]. Within sol_auth_middleware:execute/2 (sol_auth_middleware.erl:281–289):

  1. API-version check — anthropic-version pinned on /v1/messages (sol_auth_middleware.erl:461–475).
  2. Rate limit — default-on per-token budget (300 rpm + 30 burst, ) or the dedicated limiter; dead limiter → 503 fail-closed (sol_auth_middleware.erl:291–320, 867–924).
  3. Maintenance gate — non-exempt paths answer 503 while enabled (sol_auth_middleware.erl:322–350).
  4. Token extraction — zerg_ticket subprotocol → zerg_auth → Authorization: Bearer → zerg_session cookie → ?token= (off by default, ) (sol_auth_middleware.erl:477–530).
  5. Validation → identity (see Identity sources).
  6. RBAC — one required permission per {Method, Path}, exact string membership (sol_auth_middleware.erl:557–600).
  7. Resource ownership — optional second layer from ?RESOURCE_SCOPES (sol_auth_middleware.erl:701–764).

Both 6 and 7 always run for every authenticated (and anonymous-exempt) request; step 7 runs even when step 6 finds no required permission (sol_auth_middleware.erl:558–560).

Identity sources

Principaluser_uuidpermissionsMechanism
Mango session tokenMango user uuidresolved from team roles at validate timesol_auth.erl:232–243 → sol_mango_client:validate_token → Mango AuthSystem.validate (mango/systems/auth.py:654–713)
Mango service tokenowning user uuidsame resolution as sessionsame path; token_type is carried but does not widen grants
Mango refresh token——refused by Sol (refresh_disabled, sol_mango_client.erl:432–435)
WS one-time ticketbound user + permission snapshotminted via REST, 60 s single-use; : honored ONLY on the WS handshake route (/api/v1/chat/:session_id/ws, derived from the route table) — any other route presenting the zerg_ticket subprotocol answers 401; a ticket is not a bearersol_auth_middleware.erl (the {ticket, _} arm + is_ws_handshake_path/1)
Local-mode static tokensha256(token)[0:16]["*"]sol_auth.erl:156–170
Dev identity (auth disabled)<<"dev">>["*"]only on explicit auth_enabled=false; server error never produces it — sol_auth:enabled/0 fails closed to “enabled”
Anonymous (exempt path)<<"anonymous">>[]sol_auth_middleware.erl:442–451

The resolved #{user_uuid, permissions} map is placed in the process dictionary (sol_identity, sol_auth_middleware.erl:690–699) and must be forwarded explicitly into any deferred execution (task opts, ZMQ dispatch) gen_servers and spawned workers never inherit it.

Scope matching rules

Exact {Method, Path} match wins, then longest prefix; ties break by binary order — fully deterministic since then L9 (sol_auth_middleware.erl:590–594, 784–811). Prefix matching is path-segment bounded: /api/v1/agents never matches /api/v1/agents-public (sol_auth_middleware.erl:788–798). Trailing-slash rules are self-bounded subtrees: {<<"POST">>, <<"/api/v1/workflows/">>} covers every /api/v1/workflows/:id/action (sol_auth_middleware.erl:74). Membership check is exact-string or the bare global * — no wildcard or namespace expansion on the Sol side (sol_auth_middleware.erl:596–600). Makes that the authoring contract on BOTH planes: Mango’s _validate_permissions (mango/systems/rbac.py) refuses ns:* and the legacy Mango-only admin:* alias at every role create/update with a typed MangoError. The declared policy is permission_policy in the shared RBAC fixture (global_wildcard: true, namespace_wildcards: false, admin_alias: false), and the lint pins it against the Sol matcher source. Roles stored before keep read-compatible wildcard expansion through _match_permission — a legacy read matcher, not the authoring contract. Grant exact scope strings. Load-time validation refuses ambiguous (shadowed) prefix rules at boot (sol_auth_middleware.erl:818–852, wired from sol_app.erl:1119).

HTTP scope table (ENDPOINT_PERMISSIONS)

116 route rules → 61 distinct scopes. “Gate” is permission, or permission + ownership / permission + admin where a ?RESOURCE_SCOPES rule layers on top (see next section).

Inference

ScopeRoutesGateNotes
inference:usePOST /v1/messages, POST /v1/chat/completionspermissionOpenAI/Anthropic-compatible surface (sol_auth_middleware.erl:169–170)
inference:startPOST /api/v1/startpermission:181
inference:stopPOST /api/v1/stoppermission:182
inference:stop_allPOST /api/v1/stop-allpermission:183
inference:preparePOST /api/v1/prepare/permissionregistry prepare, 202 + async hop:184
inference:discoverPOST /api/v1/discoverpermissionPOST-only in spec:180
inference:listGET /api/v1/pspermission:177
inference:catalogGET /api/v1/catalogpermission:185
models:readGET /api/v1/models, GET /v1/modelspermission:160,162

Tasks, workflows, orchestration

ScopeRoutesGateNotes
tasks:readGET /api/v1/tasks, GET /api/v1/tasks/outboxpermissionlists are owner-filtered at the handler:142,147
(task detail)GET /api/v1/tasks/:idpermission + ownershiptasks:read resolves via the segment-bounded prefix of the bare rule; own scope on the /tasks/ prefix:142,255
(task detail mutations)POST/PUT/PATCH/DELETE /api/v1/tasks/:idownership onlyno ENDPOINT_PERMISSIONS rule resolves — permission layer passes, own scope still enforced:261–263,267
workflows:readGET /api/v1/workflows, GET /api/v1/workflows/, GET /api/v1/recipes, GET /api/v1/recipes/permission + ownership (workflow detail):72,75,82,83
workflows:startPOST /api/v1/workflows/start, POST /api/v1/recipes, POST /api/v1/recipes/permission:73,80,81
workflows:cancelPOST /api/v1/workflows/ (subtree)permission + ownership:74
orchestrate:createPOST /api/v1/orchestratepermission:225
(orchestrate detail)GET /api/v1/orchestrate/:idownership onlyown scope, sol_task_store owner:266
schedule:readGET /api/v1/schedule, GET /api/v1/schedule/permission:201,206
schedule:managePOST /api/v1/schedule, POST /api/v1/schedule/, DELETE /api/v1/schedule/permission:196–208
schedule:spawnPOST /api/v1/schedule/spawnpermission + adminexact rule in RESOURCE_SCOPES:195,270
zmq:dispatchPOST /api/v1/zmq/dispatchpermission:186
zmq:listGET /api/v1/zmq/workerspermission:187
zmq:statusGET /api/v1/zmq/statuspermission:188
acp:listGET /api/v1/acp/agentspermission:189
acp:messagePOST /api/v1/acp/agents/permission:190
teams:listGET /api/v1/teamspermission:191
teams:createPOST /api/v1/teamspermission:192
teams:managePOST /api/v1/teams/, DELETE /api/v1/teams/permission:193,194

Chat, sessions, conversations

ScopeRoutesGateNotes
chat:createPOST /api/v1/chat, POST /api/v1/chat/:id/message, POST /api/v1/chat/:id/ws-ticketpermissionshared sol_chat_authz:rest_rules/0
chat:readGET /api/v1/chat, GET /api/v1/chat/:idpermissionshared table (same source as the WS frames)
chat:deleteDELETE /api/v1/chat/:idpermissionshared table
sessions:createPOST /api/v1/sessions/permission:97
sessions:readGET /api/v1/sessions/permission:98
sessions:deleteDELETE /api/v1/sessions/permission:99
conversations:listGET /api/v1/conversationspermission:237
conversations:createPOST /api/v1/conversationspermission:238
(conversation detail)GET /api/v1/conversations/:idpermission + ownershipconversations:list resolves via the segment-bounded prefix of the bare rule; own scope:237,253
(conversation delete)DELETE /api/v1/conversations/:idownership onlyno DELETE rule resolves — own scope still enforced:254

Goals, memory, workspace

ScopeRoutesGateNotes
goals:readGET /api/v1/goals, GET /api/v1/goals/permissionbare form added:91
goals:managePUT /api/v1/goals/permission (owner-or-admin)POST /goals/:id/cancel is admin-scoped (next row); goals:create no longer grants create
goals:deleteDELETE /api/v1/goals/permission:92
(admin scope)POST /api/v1/goals, POST /api/v1/goals/:id/cancel{admin, require}/F3: the admin scope is the single create/cancel authority; the permission map carries no goals:create/POST-cancel rule
memory:readGET /api/v1/memory/permission:148
memory:writePOST /api/v1/memory/, DELETE /api/v1/memory/permission:149,150
workspace:readGET /api/v1/workspace/, POST /api/v1/workspace/read, POST /api/v1/workspace/search, POST /api/v1/workspace/listpermissionread-split at the middleware,:123,130–132
workspace:writePOST /api/v1/workspace/ (subtree)permission:124

Infrastructure, telemetry, providers

ScopeRoutesGateNotes
infra:readGET /api/v1/workers/bg, GET /api/v1/lua/, GET /api/v1/cluster, GET /api/v1/providers/, GET /api/v1/infra/, GET /api/v1/persistence, GET /api/v1/persistence/, GET /api/v1/telemetry, GET /api/v1/telemetry/permission:100–249
infra:managePOST /api/v1/workers/bg, POST /api/v1/lua/eval, POST /api/v1/lua/, POST /api/v1/cluster, POST/DELETE /api/v1/infra/, POST /api/v1/telemetry, POST /api/v1/telemetry/, POST /api/v1/providers/reloadpermissionincludes Lua eval/spawn and cluster ops:100–249
persistence:managePOST /api/v1/persistence/permission:229
settings:readGET /api/v1/managed-settingspermission:226
settings:writePUT /api/v1/managed-settingspermission:227
circuits:listGET /api/v1/circuitspermission:223
circuits:resetPOST /api/v1/circuits/resetpermission:224

Observability, audit, marketplace, skills, dashboard

ScopeRoutesGateNotes
audit:readGET /api/v1/audit, GET /api/v1/events, GET /api/v1/replay/permission:76,78,164,165,167
admin (require)GET /api/v1/audit/verifyadmin: the anchored integrity verdict — the exact RESOURCE_SCOPES rule overrides the /api/v1/audit prefix (audit:read); operator-remediation surface only
audit:streamGET /api/v1/sync-events (SSE)permission:79
metrics:readGET /api/v1/metrics, GET /api/v1/supervisor, GET /api/v1/license/statuspermission:77,84,163,171
marketplace:browseGET /api/v1/marketplacepermission:209
marketplace:publishPOST /api/v1/marketplacepermission:210
marketplace:manageDELETE /api/v1/marketplace/permissionungated until:214
skills:browseGET /api/v1/skillspermission:215
skills:publishPOST /api/v1/skillspermission:216
skills:manageDELETE /api/v1/skills/permissionungated until:222
channels:readGET /api/v1/channelspermission:151
channels:managePOST /api/v1/channels, POST/PUT/PATCH/DELETE /api/v1/channels/permission (+ handler admin gates on some actions)PUT/PATCH covered since then:151–159

Agents

ScopeRoutesGateNotes
agents:readGET /api/v1/agentspermission:102
agents:managePOST /api/v1/agentspermission:103

Resource scopes (ownership + admin layer)

?RESOURCE_SCOPES (sol_auth_middleware.erl:252–279) adds a second check After the permission check passes. Three shapes (sol_auth_middleware.erl:701–764):

{admin, require} → sol_identity:is_admin (permissions contain *) or 403. Exact-match routes only — the prefix matcher cannot disambiguate sibling actions on parameterized paths (sol_auth_middleware.erl:705–709). {own, {Module, Function, BindingKey}} → admin passes; otherwise Module:Function(ResourceId) resolves the owner and sol_identity:is_owner/1 compares it to the caller (sol_identity.erl:33–39: * holders pass, else uuid equality). undefined → no ownership rule; the layer is a pass-through.

RuleScope shapeOwner sourceNotes
GET/HEAD/DELETE /api/v1/conversations/ownsol_conversation:get_owner(conv_id) (sol_conversation.erl:77):253,254
GET/HEAD/POST/PUT/PATCH/DELETE /api/v1/tasks/ownsol_task_store:get_owner(task_id) (sol_task_store.erl:236)mirrored across methods:255–263,267
GET/HEAD /api/v1/orchestrate/ownsol_task_store:get_owner(id):266; HEAD folds to GET
GET/HEAD/POST /api/v1/workflows/ownsol_workflow_manager:get_workflow_owner(id) (sol_workflow_manager.erl:164):268,269
POST /api/v1/schedule/spawnadmin—exact-match route:270
POST /api/v1/debug/admin—eflame profiling stacks,:273; POST-only since then
POST /debug/pprof/admin—also handler-gated by enable_pprof (default false):278; sol_http_debug.erl:12; POST-only

The profiler family starts CPU work, so it is a mutation for CSRF purposes: the middleware rule is POST, and GET/HEAD/every other verb answers a typed 405 + Allow: POST. For non-profiler routes, HEAD authorizes as GET (the middleware folds it into the GET membership check; ). Streaming routes are the explicit exception: they are GET-only and answer HEAD with a typed 405 + Allow: GET before any SSE admission.

Handler-level admin gates still exist where one parameterized path carries sibling actions the middleware cannot split (e.g. channel detail mutations, schedule detail reads) — the middleware rule is the coarse gate, the handler check the fine one (sol_auth_middleware.erl:197–200, sol_http_channels.erl:18ff).

Failure semantics of the owner lookup (sol_auth_middleware.erl:730–761):

Owner lookup resultBehavior
{ok, Owner} and caller is owner/adminpass
{ok, Owner} and caller is not403 insufficient_permissions
{error, not_found} / {error, {not_found, _}}pass through — the handler re-checks and answers 404 itself (no existence oracle: a 403 here would confirm the object exists)
any other error (store down)fail closed: 503 owner_store_unavailable + owner_store_error counter

The execute class: tasks:execute

tasks:execute is not an HTTP route scope — no middleware rule requires it. It is the dispatch-plane grant that authorizes execute-grade behavior on workers. Execute-class tools are bash, code_exec, task, background_spawn (client/core/permission_checker.lua:245–249).

Sol side (dispatch clamp)

sol_zmq_task_dispatcher (server/src/sol_zmq_task_dispatcher.erl):

Grant check has_execute_grade/1 (:519–528): *, or the exact string tasks:execute, or any :write-suffixed grant while legacy_write_implies_execute is true (default true for existing installs; new installs should set false). Permission_mode clamp clamp_task_permission_mode/2 (:459–483): the user-supplied permission_mode wire field must be one of the 6 valid modes (allow-all, deny-all, read-only, default, plan, auto, sol_zmq_task_dispatcher.erl:39–42); anything else is rejected to default. A requester without execute grade may not select allow-all/auto — both are clamped to read-only with a counted metric (:485–501). A degraded {system,[]} identity clamps like any read-only requester. No identity sniffing: the only bypass is the explicit internal_dispatch => true flag, which is stripped from user-supplied opts at the single send funnel before the clamp reads the map (:504–509) — public callers cannot forge it. Wire forwarding: permissions is ALWAYS present on the wire (, 224–240) and the dispatcher snapshots user_uuid + permissions into the durable dispatch receipt, so the worker enforces the caller’s grant, not the worker’s own config.

Luna side (worker mirror)

check_server_permissions (client/core/permission_checker.lua:272–331), consumed at the top of check (:334–341):

Server grant (wire permissions)Effect on worker
absent (nil — legacy Sol)skip server gate; local config only
[] (explicit-empty)deny-default for write/execute-class tools in enforced modes
["*"]admin override → allow all
contains *:execute suffix matchexecute-class tools may proceed to local rules
contains *:write and legacy flag trueexecute-class proceeds (legacy rule)
only *:readwrite/execute denied (deny-wins, )

Known asymmetry (recorded): Sol’s grant check requires the exact string tasks:execute (sol_zmq_task_dispatcher.erl:526), while the Luna mirror accepts any :execute-suffixed grant (client/core/permission_checker.lua:296). Grant tasks:execute literally to satisfy both.

Children spawned by a task inherit the server grant as a ceiling with a deny-all default; legacy_write_implies_execute lives in client/core/config.lua:425–436.

Admin, service tokens, and user tokens

Admin means the identity’s permission list contains the literal * (sol_identity.erl:41–50). * also bypasses every ownership check (sol_identity.erl:33–39) and grants every scope (sol_auth_middleware.erl:598). Mango’s handler-side is_admin also requires the literal * (mango/mango/handlers/init.py:1631–1644): the legacy Mango-only admin:* alias is INERT on both planes since then/ (new role writes have refused it since then; migration v0020 strips stored aliases). Session vs service tokens resolve permissions through the same path (team roles → permission set, mango/systems/auth.py:668–702). The credential class is still enforced per-route, but /auth/revocations additionally requires authority, not just a service token: the revocations:read permission, the bare * admin binding, or the MANGO_REVOCATIONS_READ_USERS uuid allowlist . The permission is declared in the Mango classification fixture and never seeded to a default role; a zero-permission service token therefore gets 403 . User-token semantics are deny-default: an identity with [] passes only routes with no required permission (and no admin/ownership rule). Some actions are Mango-side gated and never appear in Sol’s map: auth:self covers password change and self-service token revocation (mango/mango/handlers/init.py:477–486, mango/mango/handlers/auth.py:1282); Mango’s own CRUD routes (/users, /roles, /teams, /orgs) derive actions as <resource>:<method-verb> (mango/mango/handlers/init.py:447–492) and are checked against the same roles.permissions strings.

Mango composition (roles → scopes)

How a Mango role becomes a Sol scope grant:

  1. Roles are rows of opaque permission strings: "*" or namespace:action (validated, mango/systems/rbac.py:29–40). Roles attach to teams, teams to users (user_teams → team_roles → roles).
  2. At token validation, Mango unions the permission sets of all roles on all of the user’s teams and returns the sorted set (mango/systems/rbac.py:304–345 → mango/systems/auth.py:668–702).
  3. Sol receives that set verbatim and applies exact-string membership (see matching rules).

Honest composition caveats:

New Mango roles cannot carry namespace:* (or admin:*) grants: _validate_permissions refuses them at create/update. Roles written by older releases may still hold those strings, and the legacy _match_permission read matcher keeps expanding them for backward compatibility — but such a grant is dead on the Sol plane, which matches exact strings plus the bare * only. Only * (bare) spans both planes. The seeded roles (mango/systems/rbac.py seed_default_roles) are pinned to one shared vocabulary by server/test/fixtures/rbac_permission_matrix.json + ci/rbac_permission_vocabulary_lint.py. Three grants are Mango-side only — auth:self, users:read, user_tasks:read (the Mango route derivation consumes them) — and carry an explicit mango_scopes classification; every other seeded string is a Sol scope. The previous drift (scheduler:read vs the Sol schedule:read, plus the consumed-nowhere teams:members and dashboard:read) is RETIRED from the seeds; Mango migration v0011 rewrites upgraded installs onto the canonical list. Caching: Sol caches validated identities for 5 s with a 256-entry LRU (sol_mango_client.erl:34–36) and flushes on invalidate_user/ invalidate_role (sol_auth.erl:105–117); Mango caches per-user permission sets behind an epoch guard so a raced invalidation refetches rather than serving pre-revocation state (mango/systems/rbac.py:347–367), and empty sets are never cached (mango/systems/auth.py:696–712). Role updates are CAS-guarded so a concurrent edit can never cache the losing list (, mango/systems/rbac.py:144–201). Worst-case revocation latency is the Sol cache TTL plus the revocation resync window.

Seeded roles

Machine-checked against server/test/fixtures/rbac_permission_matrix.json by ci/rbac_permission_vocabulary_lint.py: the Mango seed lists, this table, and the Sol check set are three views of one vocabulary .

RolePermissions
admin*
memberagents:read, auth:self, channels:read, chat:create, chat:read, conversations:create, conversations:list, inference:catalog, inference:discover, inference:list, inference:use, marketplace:browse, marketplace:install, memory:read, memory:write, models:read, schedule:read, sessions:create, sessions:read, skills:browse, tasks:read, teams:list, user_tasks:read, users:read, workflows:read, workspace:read, workspace:write, zmq:list
vieweragents:read, auth:self, channels:read, chat:read, conversations:list, inference:catalog, inference:discover, inference:list, marketplace:browse, memory:read, models:read, schedule:read, sessions:read, skills:browse, tasks:read, teams:list, user_tasks:read, users:read, workflows:read, workspace:read, zmq:list

The member/viewer read legs cover the console’s reads: schedule listing (schedule:read), task polling/status (tasks:read) and the ZMQ worker inventory (zmq:list, WorkersView). zmq:status is deliberately not seeded — no Limon view or CLI verb reads /api/v1/zmq/status under a member identity.

Exempt paths and the anonymous envelope

Default exempt list (sol_auth_middleware.erl:40–44): /health, /api/v1/health, /api/v1/ready, /api/v1/infra/status, /api/v1/infra/maintenance, /api/v1/shares, the six login/validate/ logout paths, and the /api/v1/webhook/ subtree (signature IS the auth, P2-3). Operators extend via auth_exempt_paths (merged, slash-normalized, sol_auth_middleware.erl:609–655). /metrics is NOT auth-exempt a tokenless scrape is allowed only when the loopback TOPOLOGY holds (the TCP peer, not proxy headers); otherwise it needs metrics:read. The canonical generated list lives in auth-flow.md. Exempt means “no token required”, never “skip authorization”: the request continues as the anonymous envelope {user_uuid:= <<"anonymous">>, permissions:= []} through the FULL RBAC + ownership layers (sol_auth_middleware.erl:433–451). Consequence: an exempt path whose route carries a scope (e.g. /api/v1/infra/status → infra:read) answers 403 to the anonymous envelope under Mango auth. The middleware warns at load when a configured exemption overlaps any scoped route ( P3, sol_auth_middleware.erl:660–682). Truly anonymous-readable routes are ones with no rule at all (e.g. /api/v1/shares).

Failure postures

StatusWhenBody
401missing/invalid/expired token; rejected WS ticketfamily-aware envelope (sol_http_json.erl:236–262, sol_auth_middleware.erl:356–357): Zerg {"ok":false,"error":{"code":"unauthorized",...}}, OpenAI/Anthropic dialects on their routes
403scope not held, admin route, ownership mismatch — one code, insufficient_permissionssame family-aware shape (sol_auth_middleware.erl:569–575,716–720)
404object not found — raised by the handler, after the ownership layer deliberately passes not_found through (no existence oracle)handler-owned
429rate limit{"error":"rate_limited","retry_after":N} + header (sol_auth_middleware.erl:296–305)
503dead rate limiter; auth-rate-limit saturation (rate_limiter_unavailable + Retry-After), owner-store transient failure; maintenance mode; Mango RBAC lookup outage (Retry-After 30, mango/mango/handlers/init.py:418–430)typed JSON envelopes — an outage is never rendered as 403/500

Scope inventory summary

61 distinct HTTP scopes (116 route rules) across ?ENDPOINT_PERMISSIONS/?RESOURCE_SCOPES + the shared sol_chat_authz:rest_rules/0 table. 3 admin-gated rules in ?RESOURCE_SCOPES (schedule:spawn + 2 debug families); 10 ownership (own) rules. 1 dispatch-plane execute scope (tasks:execute) — not an HTTP scope. 3 Mango-side grant strings outside Sol’s vocabulary: auth:self, users:read, user_tasks:read (all consumed by Mango’s own route derivation; classified in the shared fixture’s mango_scopes). The bare * is the admin/wildcard grant, not a scope.

See also

permissions.md — client-side permission modes, rulesets, danger detection, AI classifier. auth-flow.md — token issuance, validation, revocation. security.md — transport trust plane, threat model. api-reference.md — route-by-route API surface.