Expand description
Provider-dispatch authorization: safety-class → scope affinity, caller trust discipline, and structured security decisions.
Modeled on axon’s axon-authz execution-affinity layer, adapted to
Soma’s provider kinds and its stricter write-satisfies-read scope rule
(crate::scopes::scopes_satisfy). This layer governs dynamic provider
execution only — built-in actions keep their ACTION_SPECS scope
checks in the MCP server layer.
Three invariants this module enforces by construction:
- Affinity: every classified dispatch target has a minimum scope derived from what its handler can do (execute code, egress to the network, …), independent of the scope the tool manifest declares.
- Trusted-local discipline: exactly one constructor
(
CallerContext::trusted_local_caller) can settrusted_local; the remote/scoped constructor hard-codes it tofalse, so a network caller can never claim local trust. - Deny-by-default: an unclassified target denies with a stable machine-readable reason instead of falling through to “allow”.
Modules§
- reasons
- Stable machine-readable decision reasons. These are API: never rename an existing constant’s value, only add new ones.
Structs§
- Caller
Context - Who is asking for a dispatch. Fields are private on purpose: the only
way to obtain
trusted_local = trueisSelf::trusted_local_caller. - Security
Decision - A decision object, not a bool:
allowedplus a stable machine-readablereasonfromreasons, plus human-oriented advisorywarnings.
Enums§
- Execution
Mode - Where a handler executes relative to the Soma host process.
- Safety
Class - What a dynamic provider’s handler is capable of doing when invoked,
classified from the provider manifest
kind.
Functions§
- authorize
- Authorizes one dispatch: affinity scope + the trusted-local inline rule, deny-by-default for unclassified targets.
- authorize_
provider_ kind - Convenience for the provider-dispatch chokepoint: classify a manifest kind, derive its execution mode, and authorize in one call.
- required_
scope_ for_ safety_ class - Minimum scope a caller must hold to execute a target of this class, regardless of the scope declared on the individual tool. The tool’s own declared scope is still enforced separately on top of this floor.