Map: exarch / policy
exarch’s sandbox is ral’s grant: policy/ composes the
CLI flags into a frozen GrantStack, and the stack’s per-check fold is the one
meet that ever runs (capabilities,
object-not-name).
ceiling = base ◁ extension?
stack = [ceiling, restrict₁, …, restrictₙ, deny(restricts)?, deny(credentials)?, self?]Composition — policy.rs
for_invocation(cwd, scratch, base_name, extension, restrict_files, own)
builds a FreezeCtx over the cwd and scratch, reads
provider::credential_files(), and calls compose. It returns
Invocation { stack, restricts }: the invocation’s own layers and the
restrict files’ absolute paths. lib.rs::run passes
sandbox::pinned_arg0() as own.
for_workspace(base, folders, scratch) is exarch-gui’s host stack. Its cwd
is the first writable folder, else the scratch; under a base that confines
writes (Base::confines_writes, read-only alone), every folder is
read-only and the cwd is the first folder. Below dangerous, the base’s
ceiling is extended to read every folder and write each writable one, and
under reasonable, minimal and confined to execute in it, and a second
layer admits only ShellVerb::Chdir, withholding Detach, so a rebind
reaches every command the session started. secure_host_stack, which seals
synod’s host stack too, then adds the carve-outs below, as for an invocation.
- Ceiling.
resolve_baseloads the named base; an--extendfile loads as aFragmentandGrantLayer::extendadds it, still one layer (◁: an allowance never removes authority, an exclusion always wins; authority-is-belnap-evidence). - Restricts. Each
--restrictfile is pushed as its own layer. - Deny layers, only when
!stack.fs_is_top(): one over the restrict files’ own paths (if any), then one over exarch’s and synod’s credential files (a-grant-never-reaches-its-own-key). As separate layers no profile can omit them and no--extendcan widen them. The--extendfile is not denied. - Self layer, only when
!stack.exec_is_top():self_layerexcludes the binaryownnames from exec, so no agent of a restricted session, nor any child, starts exarch.own: Nonehere refuses asPolicyFailure::OwnBinaryUnpinned. dangerouswith no restrict restricts no axis: no layer is added and no launch needs an OS sandbox.
deny_layer and self_layer are constructors: each builds typed Axes, and
carve_out encodes them as a GrantValue, decodes it with decode_fragment
and returns GrantLayer::root().extend(fragment) — a grant value decoded by
the one front end
(a-grant-is-decoded-where-it-lands).
Every path is held by freeze::host_absolute first; one it refuses fails the
layer whole, since a deny naming nothing would fail open.
Loading — policy/load.rs, policy/base.rs
-
parse_baseis the one parser of a base’s name, refusing withPolicyFailure::UnknownBase, which offers every base.Baseserialises in its kebab-case spelling. -
base_value(base)evaluates a built-in base to itsFOValue, in a shell standing at the filesystem root, since a base is closed; it is the guest ceiling underexarch --vmand exarch-gui’s VM mode.resolve_basedecodes it against aFreezeCtx. -
Profiles load through
ral_core::shell::load::profile::load_capabilities_from_*(load_fragment_from_*for--extend), the surface of ral’s--capabilities. That runsevaluate_closedwith thetypecheck::table::declared(Form::Grant)options table: a profile is a closed unit checked and run under Σ, seeing no session bindings. -
Places (
`home,`xdg-*,`cwd,`scratch,`gitdir) anddirselectors resolve as the profile loads, throughral_core::shell::grant’s decoder; composition sees only resolvedGrantLayers (capability-freeze). -
loadputs a refusal under the flag that named the file, keeping its hints; anexitor stop inside a profile becomesPolicyFailure::EscapedLoad.absolute_inanchors a command-line path at the cwd. -
The decoder drops dead grants: a bare exec name found neither on
PATHnor among the platform’s bundled tools (name_rules), and a path rooted in a foreign platform’s convention.
Spawned children
base_layer(base_name, ctx) is exarch’s GrantNarrower, installed as the
engine installer’s narrow. It resolves a base against the child’s cwd and
scratch.
- A spawn’s grant is one layer
(a-spawn-is-one-layer):
SpawnGrant::layer(core/src/shell/grant/spawn.rs) mapsInheritto ⊤,Base(name)to the narrower, andRestrict(record)todecode_grant. enquiry.rs::Grant::decodeadmits`inherit, the spawnable bases and`restrict RwithRa map;Base::spawnableexcludesdangerous(⊤ is spelled`inherit) andminimal(it names no bundled tool).- The desk’s
child_engine(agent/desk/agents.rs) hands theMarshalledparent toIdentityTransport::childorAttach::child; core’sShell::child_ofreads the image with the parent’s stack and pushes the grant’s layer withSpawnGrant::narrow_onto(transport). - The fold ANDs every layer, so a spawn only narrows: a network-off parent
stays offline under a child’s
minimal. A spawn’sRgets no self-deny layer; it has no file on disk.
The six bases — exarch/data/*.exarch.ral
Embedded by include_str!; Base lists them loosest first.
| base | fs write | net | gpu | exec |
|---|---|---|---|---|
dangerous | ⊤ | ⊤ | ⊤ | ⊤ (return ()) |
reasonable (default) | cwd, scratch, gitdir | on | on | dir path, every dirselector,cwd, scratch`, everyday names |
edit-only | cwd, scratch | on | withheld | dir xdg-bin, system, homebrew, /usr/local/bin and the sbin dirs, everyday names; no writable dir; denies git |
read-only | scratch | on | withheld | edit-only’s dirs plus cwd, everyday names; denies kill |
minimal | cwd, scratch | on | withheld | dir system, cwd, scratch` |
confined | cwd, scratch | offline | withheld | dir system, dir homebrew, /usr/local/bin, cwd, scratch, bundled names |
- Every spawnable base names each bundled tool (
core/src/uutils.rs):Command::from_namemakes one aProgram::Toolwith no path, so nodirprefix matches it.every_grantable_base_settles_the_bundled_toolspins this per build configuration. minimal,read-onlyandedit-onlydenybash,zsh,cmd,powershellandpwshby name;shstays admitted.reasonable,read-onlyandedit-onlyread the XDG dirs and named toolchain caches and denyxdg-configgh,op,gcloud;reasonablealso denies~/.dotnet/corefx.- No base writes
xdg-cache; exarch pointsXDG_CACHE_HOME,TMPDIRand the legacy tool homes into the scratch (exarch). - Where the engine host cannot withhold the GPU, the prompt says so.
Tests in policy/base.rs pin these per base: dangerous_is_root,
confined_is_offline_subpath_only_no_home_reads,
read_only_does_not_write_cwd, reasonable_lists_every_selector,
the_narrow_bases_withhold_the_gpu, reasonable_and_read_only_admit_git,
minimal_admits_system_git_not_homebrew,
every_exec_base_admits_live_system_tool_roots. policy.rs’s
the_default_boot_grant_reads_as_pinned pins the boot grant the agent reads
against policy/golden/default-boot-grant.md.
exarch/examples/git.exarch.ral is the canonical --extend;
git_extension_extends_into_git_capable_profile pins that extending minimal
with it admits git and ~/.gitconfig, and that extending reasonable
keeps its credential denies (deny sets union).
The prompt prints each layer in grant syntax
(exarch, a-grant-has-one-outward-form).
The host reads authority only through core’s accessors
(no-core-repr-leak-into-exarch).