Expand description
agent-bridle — the facade.
Re-exports the agent_bridle_core leash and assembles the default tool
Registry a host consumes. Tools are registered through the explicit
builder (DESIGN §5) — the DCE-proof path under strip+lto release
profiles — and each tool’s symbol is anchored here by a pub use, so the
linker can never silently drop one from tools/list.
use agent_bridle::registry;
use agent_bridle::{Caveats, CountBound, Scope};
let reg = registry();
let granted = Caveats {
exec: Scope::only(["echo".to_string()]),
max_calls: CountBound::AtMost(2),
..Caveats::top()
};
let out = reg
.dispatch("shell", serde_json::json!({ "program": "echo", "args": ["hi"] }), &granted)
.await?;
assert_eq!(out["exit_code"], 0);Modules§
- net_
proxy - Loopback egress proxy for the macOS
nethost allow-list (#124, ADR 0016). - operator
- Operator-authz contract — the shared types that bind an authenticated human operator to a permission decision (newt-agent #1354, the “web-authz triangle”, from the PR #1353 security audit).
- policy
- OCAP durable-policy schema — the shared contract for per-verdict permission policy (agent-bridle #220; newt-agent #1126 track O).
Structs§
- Attest
Requirement - What step-up an action demands before the gate will mint a context for it.
- Attestation
- A content-addressed, non-repudiable record that a human authorized a specific action — Provenance that becomes a Scar in the causal log. It carries its own proof: the credential id + signature prove which authenticator, the challenge proves which action, the generation proves which flight.
- Backend
Toggles - Backend availability toggles (subsumes
BRIDLE_REQUIRE_*). - Bridle
Config - The complete, layered bridle configuration (mechanism). Every field defaults to today’s behavior; see the module docs for the authority-vs-mechanism split.
- Brush
Shell Tool - The carried brush engine (agent-bridle#20 / Track 2): a bash-in-Rust
shell run in a dedicated sandboxed worker. Its
CommandInterceptorprovides the worker-local L2 leash; when an effective native backend engages, the worker and descendants inherit that L3 boundary. Opt-in via thebrushfeature; a construction-time alternative toShellToolbehind the ADR 0005 D2 seam, using the temporarybrush-ocap-*fork (reubeno/brush#1184). The carried brush engine — aToolthat runs a free-form command string through a worker-hosted bash-in-Rust shell with a worker-localCommandInterceptorleash and any L3 boundary engaged by the effective caveats. Registered under"shell"(the ADR 0005 D2 seam), a peer ofShellTool/HostShellTool. - Call
Request - The action a leash decision is about: a tool name, its arguments, and the resolved resource the policy keys on.
- Caveats
- The capability set an agent holds — one element of the authority meet-semilattice. See the module docs.
- Challenge
- A what-you-see-is-what-you-sign challenge: the content address of
DOMAIN ‖ action_id ‖ generation ‖ nonce. The authenticator signs this, so a verified signature proves the human authorized that exact action, in that causal generation, for that single-use nonce. - Confined
Child - A spawned child together with the OS sandbox actually in force around it.
- Confined
Command - Builder for a subprocess confined by a
ToolContext. - Content
Id - The content address (BLAKE3) of a canonicalized
CallRequest— a stable, collision-resistant identity for “this exact action.” - Denial
- One structured leash denial recorded by the in-process interceptor.
- Descendant
Exec - Parse and inspect Brush shell source without expansion or execution.
- Discharge
- A human-presence proof presented to the gate. Crypto-format-agnostic: the
signatureandcredential_idare opaque bytes aDischargeVerifierinterprets (e.g. theEd25519Verifierreads them as a raw ed25519 verifying key + assertion, under theverifier-ed25519feature). - Discharge
Attempt - A presented step-up proof, bundled: the single-use
noncethe challenge was bound with, theDischargeitself, and theDischargeVerifierthat checks it. Grouping the “proof” inputs keepsGate::authorize_with_dischargeto a small argument list and distinct from the “what” (tool, grant, request, policy). - Disclosure
- Operator-facing disclosure — what an operator should know about how this
run was shaped, kept strictly separate from the
EnforcementReport(ADR 0016 precedent / ADR 0017 D6). Disclosure is informational: it records over-delivery, disabled normalizations, a forced backend, and the loudunbridledopt-in. It never participates incrate::fence_strengthor the enforcement claim — a run can never raise its confinement claim by disclosing something, and disclosing something can never lower it either. - Enforcement
Report - Per-axis confinement report for the four OS-confinement Caveat axes
(
fs_read,fs_write,exec,net). - Gate
- The leash enforcer. One gate backs a session (or a sub-delegation); it tracks the remaining call budget and the generation it is valid for.
- Gate
Policy - Gate defaults (
gate.rsconstants) — and the human-gesture axis of the ADR 0018 mode lattice. - Inspected
Command - Parse and inspect Brush shell source without expansion or execution.
- Inspected
Construct - Parse and inspect Brush shell source without expansion or execution.
- Inspected
Redirect - Parse and inspect Brush shell source without expansion or execution.
- Limits
Policy - Shell-tool + egress-proxy limits (
shell_tool.rs/net_proxy.rsconstants). Anti-drift tests for these land with the wiring PR (#143) where the consts live. - NetPolicy
- Network policy — refines how the
netauthority axis (Scope<String>) is interpreted/enforced; defaults to today’s exact-host behavior (empty rules). A structured rule is proxy-enforced (userspace) ⇒ the honesty report keeps a non-loopback allow-listadvisory, neverkernel(#152). - Noop
Sandbox - The no-backend sandbox: applies nothing and reports
SandboxKind::None. - Normalization
Policy - Toggles for the automatic “normalizations” (assists) — each defaults to today’s always-on behavior; only loosening-safe ones are exposed as on/off (safety normalizations like fs canonicalization and env-scrub are intentionally absent here — see ADR 0017).
- Path
List - A configurable path list with extend-by-default semantics:
resolve()returnsbase ∪ extraunlessreplaceis set, in which case onlyextrais used. This lets config widen a security-relevant list (add a read path) safely, while shrinking one (dropping a loader path that would break confinement) requires an explicitreplace = trueopt-in. A widening is surfaced viaPathList::widensso it can be disclosed (never silent). - Proxy
Handle - A running loopback egress proxy. Dropping the handle shuts it down.
- Registry
- A catalog of tools that dispatches through the leash.
- Registry
Builder - Explicit builder for a
Registry. The supported, DCE-proof registration path. - Rootfs
Cache - A content-addressed cache of materialized minimal rootfs trees (#112 / ADR
0013 D7). Building a rootfs (resolving the
lddclosure + assembling the tree) is the expensive step; keying it by the (granted-binaries + resolved closure) identity lets repeated runs of the same toolchain reuse the build. - Rootfs
Entry - One path the minimal rootfs exposes.
- Rootfs
Plan - The plan for a minimal rootfs: exactly the paths to expose, nothing else.
- Rootfs
Policy - Minimal-rootfs builder inputs (
rootfs.rsconstants). - Rule
- One policy rule mapping an action selector to a required step-up.
- Sandbox
Policy - Sandbox path lists + ABI floors (
sandbox.rsconstants). - Sandboxed
Worker - Builder for a fixed Agent Bridle worker born under the ordinary confinement
funnel. Unlike
ConfinedCommand, the executable is mechanism configuration chosen by the trusted embedder and the entrypoint arguments are fixed byTrustedWorkerKind; model-authored arguments never reach the spawn boundary. - Sandboxed
Worker Child - A fixed internal worker together with its take-once parent control channel.
- Shell
Inspection - Parse and inspect Brush shell source without expansion or execution.
- Shell
Inspection Error - Parse and inspect Brush shell source without expansion or execution.
- Shell
Invocation Id - Process-local identity for one shell tool invocation.
- Shell
Tool - The confined shell tool.
- Step
UpPolicy - The per-action step-up policy: a set of selector rules plus a fall-through
default. Most-specific (longest matching selector) wins. This is the
authoring surface behind the operator menu (yes once / yes always / yes on
passkey / no); it composes on top of the
Caveatsgrant —Caveatsdecides whether the authority exists, this decides what gesture admits its use. - Tool
Context - Proof that a tool invocation has passed the capability leash, carrying the least-authority caveats it is permitted to act under.
- Tool
Envelope - A structured execution result. Serialized to the MCP content shape via
ToolEnvelope::into_json; absent fields are omitted. - Trusted
Worker Request - Core-owned authority envelope received by a fixed trusted worker.
- VmPolicy
- Micro-VM / jail parameters (
jaildconstants). Anti-drift lands with wiring (#147). - WebPolicy
- Web-fetch limits (
web_fetch.rsconstants). Anti-drift lands with wiring.
Enums§
- Axis
Enforcement - How a single restricted Caveat axis is actually enforced for a run (ADR 0004 D1).
- Bridle
Mode - The top-level confinement mode.
Bridled(default) confines per the caveats + backends;Unbridleis the explicit, acknowledged, honest “off” (grantCaveats::top(), advisory floor,SandboxKind::None) — resolved by the loader (#151), never reachable by omission. - Child
Network Policy - How a confined child’s direct network-socket authority is enforced, beyond
the caveat-driven Landlock TCP rule. A mechanism knob (it rides
SandboxPolicy), never authority (Caveats): the caller states the required floor and the backend owns the enforcement (ADR 0017). - Count
Bound - A numeric upper bound axis (e.g. “at most N tool calls”).
- Decision
- The gate’s verdict for one call under a step-up policy.
- Denial
Kind - Which kind of capability operation the leash refused.
- Host
Match - How a host is matched.
#[non_exhaustive]so REST/gRPC predicate variants (#153) can be added later without breaking existing configs. - Human
Gate - The human-gate posture an unbridled run still enforces (ADR 0018 D9/D11) —
the step-up floor the host will demand for a HIGH-consequence act. Distinguishes
the two unbridled postures:
Passkey/Prompt= Supervised-free (the human leash remains);None= Autonomous (no human in the loop — reachable only via the distinct second ack, D10). Disclosed on every envelope (R5). - NetDefault
- Default network posture when no rule matches.
- NetRule
- One network rule.
#[non_exhaustive]to admitRest {..}/Grpc {..}variants additively (#153/#153-followup). - Presence
- The strength of human gesture an action demands, weakest to strongest.
- Redirect
Operation - Parse and inspect Brush shell source without expansion or execution.
- Sandbox
Kind - Which OS-level sandbox actually backs an authorization.
- Scope
- A set-valued authority axis: either unrestricted (
All, the top of this axis) or exactly the listed items. - Shell
Construct Kind - Parse and inspect Brush shell source without expansion or execution.
- Shell
Output Stream - The file descriptor from which an observed shell-output chunk originated.
- Tool
Error - Why a dispatch or a tool invocation failed.
- Trusted
Worker Kind - A closed set of internal worker entrypoints. The caller cannot supply arbitrary arguments: each kind maps to a fixed private protocol.
Constants§
- TRUSTED_
WORKER_ ACK - Fixed acknowledgement emitted only after a worker authenticates its frame.
- TRUSTED_
WORKER_ BOOTSTRAP - Fixed, non-authority prelude used to establish kernel peer metadata.
- TRUSTED_
WORKER_ FRAME_ HEADER_ LEN - Exact byte length of a trusted-worker response header.
- TRUSTED_
WORKER_ HELLO_ LEN - Exact byte length of a trusted-worker hello frame.
- TRUSTED_
WORKER_ MAX_ BODY - Maximum serialized trusted-worker request body.
- TRUSTED_
WORKER_ PROTOCOL_ VERSION - Version of the private trusted-worker authority envelope.
Traits§
- Discharge
Provider - Runs the human-presence ceremony and returns a
Discharge— the dual ofDischargeVerifier(a provider produces a proof; a verifier checks one). - Discharge
Verifier - Verifies a
Dischargeagainst the requirement and the gate-recomputedChallenge. Pure: it performs no ceremony and no IO — that is a host capability outside the gate. AnErr(reason)is turned into a leash denial. - Sandbox
- An OS-level confinement that can be applied from a set of
Caveats. - Shell
Output Observer - Receives bounded shell output while a tool invocation is still running.
- Tool
- A capability the agent can invoke, governed by the leash.
Functions§
- best_
available_ sandbox - Return the strongest
Sandboxavailable in this build on this host. - brush_
private_ control_ supported - Whether this target provides the kernel-authenticated private transport
required by
BrushShellTooland carried-coreutils re-exec. - build_
rootfs_ plan - Build the minimal-rootfs plan for
effective(ADR 0013 D2). Requiresexecto be confined (Only) — a minimal rootfs is meaningless when any program may run, so an ambientexecis rejected (the caller falls back to the Tier-1 boundary). The plan contains: the resolved granted program files + each one’slddshared-library closure (incl. the loader) + the configured data paths + the grantedfs_read(ro) /fs_write(rw) roots — and nothing else. - confinement_
unenforceable - Would confining this child be a lie? Decided against the real backend
kind(the probe the spawn actually confines through — not a stale gate stamp; ADR 0012 D4) and the principal’sfloor. - decode_
trusted_ worker_ frame_ header - Decode a supervisor-to-worker frame header.
- decode_
trusted_ worker_ hello - Decode and validate a child-to-supervisor hello.
- decode_
trusted_ worker_ request - Deserialize a verified trusted-worker request body.
- default_
env_ denylist - The default loader/interpreter/hook environment denylist (AB-004). Each name here can hijack code execution inside an otherwise-allowed program.
- default_
exec_ path - The default
PATHfor a fully-authorized (exec = Scope::All) confined child: the ambient$PATHwhen set and non-empty, else the conventionalRootfsPolicysearch dirs, joined with the platform separator. - effective_
sandbox_ kind - The
SandboxKindhonestly in force forcaveatsgiven the strongestavailablebackend: the backend’s own kind when it will actually confine something, elseSandboxKind::None. The single honesty rule shared by the subprocess primitive (crate::ConfinedCommand) and the shell engine, so neither overclaims. - egress_
proxy_ plan - The egress-proxy plan for
caveats(#124/#257, ADR 0016), orNoneto fall through to the ordinary confinement paths.Some((allow_hosts, fenced))iff the grant is a general remote-hostnetallow-list (net_egress_proxy_hosts) and the available backend can kernel-fence the child’s egress to the loopback interface ([loopback_net_enforceable]) — the precondition for the proxy to be real confinement instead of a walk-around-able advisory. A proxy a rogue child can dial around is not confinement, so backends that cannot address-fence stay inert (the ADR 0015 honest posture); theirnetremains honestly advisory. - encode_
trusted_ worker_ frame_ header - Encode a supervisor-to-worker header binding challenge, body length, and content digest.
- encode_
trusted_ worker_ hello - Encode the child-to-supervisor hello that carries a fresh challenge.
- enforcement_
report - Classify each restricted axis of
effectiveunder theactivesandbox (ADR 0004 D1). Pure; no IO. - fence_
env - Drop denied loader/hook keys from
env, returning the surviving map plus the dropped names (for disclosure). SeeLimitsPolicy::env_denylist(AB-004). - fence_
strength - The fence’s overall strength: the greatest-lower-bound (weakest) enforcement
across the restricted axes of
report— a fence is only as strong as its weakest confined axis (ADR 0012 D1). ReturnsNonewhen no axis is restricted (an empty report: a top grant confining nothing — a vacuous top with nothing to enforce). Pure: recomputed from the report on every call, never stored, so it cannot diverge from the lattice it summarizes (ADR 0004 D3 / ADR 0012’s rejection of a parallel strength enum). Consumers that need to know which axis dropped the strength still read the per-axisEnforcementReport. - human_
gate - The process human-gate posture. Defaults to
HumanGate::Passkey— the human leash is assumed on unless an acked path explicitly removed it, so the Autonomous posture is never reached by omission. - inspect_
shell - Parse and inspect Brush shell source without expansion or execution.
- install_
default_ providers - Carried-coreutils registration (agent-bridle#20 / issue #206). With
carried-coreutils, the Brush engine’s non-conflicting shims re-exec<self> --invoke-bundled <name>and resolve against the dispatch-capable host binary. These functions are used by the engine internally. Install the registry from all compiled-in providers. Call once, beforemaybe_dispatch/register_shims, so both the dispatch fast-path and the shell’s shim builtins see a populated registry. - is_
unbridled - Whether this process is running unbridled. Defaults to
false(bridled) — confinement stays on unless an acked loader path explicitly calledset_unbridled. - loopback_
fenced_ caveats - The confinement caveats for a spawned child paired with a loopback egress
proxy (#124, ADR 0016): identical to
caveatsexcept thenetaxis is replaced by the loopback set plus any explicitunix:endpoints, so its [seatbelt_profile] emits the ADR 0015 kernel fence —(deny network*)+(allow network* (remote ip "localhost:*"))— while thefs/execrules are preserved verbatim. The child can then reach nothing off-box directly; its only path off the loopback interface is the proxy it is pointed at via*_PROXYenv. Pure; no IO. Only meaningful for a grant wherenet_egress_proxy_hostsisSome. - materialize_
copy - Materialize a plan by copying file entries (and creating empty mount-point
dirs for directory entries) under
dest, preserving eachsrc’s absolute path (so/usr/bin/catlands atdest/usr/bin/cat). This is the test / diagnostic path — production exposes the same plan via read-only bind-mounts (no copy) through the broker (#108). Directory entries are left as empty mount-points (their contents are bound at run time), so this does NOT recurse into large data trees like/usr/share. - maybe_
dispatch - Private Brush-worker dispatch. An embedder’s binary calls
maybe_dispatchat the top ofmainso the sandboxed worker re-exec resolves before normal application startup. Run the bundled-command fast path if the process was invoked for it. - net_
egress_ proxy_ hosts - The granted host set of a general remote-host
netallow-list — the case SBPL cannot express and [net_loopback_only] therefore leaves advisory (ADR 0015 D3).Some(hosts)iffnetisOnly(set), non-empty, with at least one non-loopback host;NoneforAll, the empty set (deny-all), and a loopback-only allow-list — those three keep their existing owners ([net_fully_denied] / [net_loopback_only]). - register_
shims - Carried-coreutils registration (agent-bridle#20 / issue #206). With
carried-coreutils, the Brush engine’s non-conflicting shims re-exec<self> --invoke-bundled <name>and resolve against the dispatch-capable host binary. These functions are used by the engine internally. Register a shim builtin for every name in the installed registry, usingregister_builtin_if_unsetso brush’s own builtins win on conflict. Callinstall_default_providersfirst. - registry
- Build the default tool registry for this host’s compiled feature set.
- set_
human_ gate - Set the process human-gate posture (ADR 0018 D10/D11). Call once, from the
loader;
HumanGate::None(Autonomous) is legal only when unbridle is also engaged and the distinct no-step-up ack was supplied — the loader enforces that before calling this. Idempotent. - set_
unbridled - Mark this process unbridled (confinement mechanism off). Call this once, from the loader, and only after the acked two-key opt-in has been verified (ADR 0018 D3). Idempotent: a second call is a no-op (the first wins).
- spawn_
confined_ subprocess - Spawn
program argsconfined bycx, with the inherited stdio of the parent. - start_
egress_ proxy - Start the egress proxy for a general remote-host
netgrant (#257) — the caveats-level convenience overstart, for an external caller. - trusted_
worker_ frame_ digest - Content digest binding one trusted-worker request to its fresh challenge.
Type Aliases§
- Tool
Result - The result type used throughout
agent-bridle-core.