The freeze boundary
A grant is resolved the moment it is decoded: decode_capability_map walks
every spelling once and returns a GrantLayer, whose rules hold what the walks
reached — positions for allowances, held objects for exclusions — and nothing
beside them. The boundary between syntactic profile and resolved
authority is a type split: nothing unresolved reaches the dynamic stack, and a
GrantLayer keeps no authored copy for anything to disagree with.
The types (core/src/authority/policy/lattice.rs):
- the grant value — the authored record: per-effect policies (
exec,fs,net, and theeditorandshellverb sets) over spellings, asgranttakes it or a host authors it for another. Nothing judges it and no layer keeps it;Capabilitiesis a test builder that spells one. GrantLayer— what a layer in force is: its rules, resolved, and the axes that name no path. Each path is aGrantPath { written, real }: the spelling as written, and what its walk made of it (Extentfor an allowance,Excludedfor an exclusion; path-judgment). Layers compose by stacking on aGrantStack, every judgment meeting the layers’ evidence at the access (authority-tables);GrantLayer::extendjoins a base with aFragmentinto one ceiling layer.
decode is the one-way crossing
Runtime records cross through decode_capability_map
(core/src/shell/grant/decode.rs), the single Value::Map → GrantLayer
function. shell::grant interprets runtime values; authority::grant owns
substantive freezing and authored resolution without runtime types;
authority::policy holds the resolved model and its judgments. The decoder
walks a .ral profile’s terminal record — or the inline
grant [...] { body } record — into a layer, resolving each spelling by the
walk as it freezes it. In doing so it:
- resolves every place (
`cwd,`home,`tempdir,`scratch,`gitdir,`xdg-*,`absolute) and every selector (`path,`system, the package managers) against aFreezeCtx, built byFreezeCtx::atfrom ownedenviron::EnvVarsand logical cwd.Shell::freeze_ctxsupplies these and the session’s scratch at the shell boundary.`tempdirreads the host’s temp dir;`scratchreads the scratch spelling the context carries, and refuses where the host made none. The freeze isauthority/grant/freeze.rs:FreezeCtx::walkedis the one place a grant’s place becomes a walked path,FreezeCtx::selectorthe one place a selector becomes many, andFrozenPath::from_surfacethe one minting entry (capability-is-data); - classifies an
absolutepayload on the raw string, before any folding, host first, so one profile loads on both platforms: a path absolute under the host’s rules is live, one absolute only under the other platform’s is a dead grant (placeanswersNone), and one absolute under neither is refused. The root is the raw/, tested before this classification (FreezeCtx::walked,Placed::Root), so it isExtent::Everywhereon every host; A well-formed forward-slash UNC//server/share/xis live on both;\x,C:xand malformed UNC roots (\\or//with no server and share) name no path anywhere. Host folding would otherwise readC:/../xon POSIX as the relativex; - validates a subpath lexically, before joining, so a profile fails alike
everywhere: the empty string, a leading separator and a drive prefix are
refused,
.is the anchor and..folds and may leave it; - rejects a
~orxdg:NAMEpayload under every tag: those prefixes are expanded at run time, never in a grant, and the error names the place meant; - rejects an
xdg-*place that escapeshome— defence in depth against an attacker-setXDG_*_HOME=/etcsilently widening a grant; - rejects every kept selector directory whose walked position is a filesystem root, the home or its ancestor, for allowances and exclusions alike. Defaults and host overrides share this breadth check; narrow external tool directories remain valid (selector rules);
- rejects a selector directory absolute to the OS that
`absolutewould refuse (a$PATHentry, or a toolchain override or default, with a malformed or mixed head), naming the variable:host_absoluteis the one classifier of what the host chooses, the system reads included, where the same refusal stops the boot; - rejects an anchored place that freezes relative (a relative
HOMEorTMPDIR) and a`homeorxdg-*place where nothing bindsHOME: no base to resolve against, and the escape guard just above is itself stated inhome’s terms, so an absoluteXDG_*_HOMEcannot stand in for one. The readers answerOption, and the reason the place cannot be frozen is the reason the author is given; - rejects a
`gitdirwhose.gitpointer file names a directory that does not name the working tree back; - rejects an exec file key that names a directory, the root included
(
root_program, raised byauthority/grant/resolve.rs), so the author is told to write`dir; a`namethat is path-shaped, since a name is a command name and a path is a place (bare_name, judged under Windows rules on every host); and an exclusion of the root, or of a link to it (PolarforExcluded,authority/grant/paths.rs), which would exclude every path.
A bare string or a relative path is no place at all: the checker refuses it
before the program runs, and the decoder refuses it again for a value that
arrived untyped. Authors write `cwd sub to pin “relative to here” once.
The inline grant, profile loader (core/src/shell/load/profile.rs) and
spawn grant (core/src/shell/grant/spawn.rs) share this decoder, and so does
every grant value a host authors, through decode_grant, decode_fragment or
Shell::decode_grant (the only public entries; decode_capability_map is
crate-private): synod’s ceiling and exarch’s boot grant (engine_root,
exarch/src/boot.rs), exarch’s carve-outs (carve_out,
exarch/src/policy.rs) and GrantValue::deny_all (evaluate_no_authority,
exarch/src/config.rs). A host spells a grant value only by encoding typed
Axes into a GrantValue (authority/grant/value.rs); Capabilities is a test
builder over the same (authority/grant/builder.rs, test_helper::decoded). root / default construct path-free
layers. So resolved by construction is a visibility fact, not a discipline: no
surface admits an unresolved layer, and no second route has laxer refusals
(a-grant-is-decoded-where-it-lands).
No grant spells “every program”. An exec record has allow and deny;
Any arises only by extending an omitted exec axis (t ⊕ fragment,
ExecRules::join_top), as --extend and exarch’s carve-outs do
(no-grant-spells-every-program).
What decode pins, and what the access resolves
Decode walks each spelling once and keeps what the walk reached; it never
touches the path of a future access, which is walked at the moment of
enforcement. A FrozenPath is the author’s spelling, folded; what it names is
the walk’s to say, once. That makes the algebra a pure function of the layers.
- An allowance is a position and is never resolved again. An fs prefix or
an exec
Path/Dirkey keeps theRealPathits walk reached, so a symlink put in its place later redirects nothing. The root spelling/isExtent::Everywhereon every host, resolved by polarity with no walk (Windows has no/to walk); a spelling that walks to the root on Unix is the same. - An exclusion is the object its spelling reached.
walk_excludedholds the object and, where it was a link, its target; the exclusion matches by position or by that object, so it holds under any new name the object gets, and a link retargeted later is still the denied link. Its positions are asked of it in one vocabulary:Excluded::holdsfor every position it holds (matching, the Unix projection, Landlock’s walk) andWalked::followedfor where an access lands (the decoder’s refusals, Windows placement andcarve) (an-exclusion-is-located-in-one-vocabulary). A bare program name is resolved where the grant is decoded, on the decoding environment’sPATH, absolute entries alone. - Resolving refuses a path that is not Unicode where it is a spelling
(
FrozenPath::freeze); a position is kept native and byte-exact. - A guest’s grant is resolved on the guest’s own filesystem, not the host’s.
synod sends it as a grant value, unfolded, in the guest engine’s
Root.config; the engine decodes it (Shell::decode_grant) where the guard that matches it runs, against the engine’s own anchor, socwdandscratchplaces work in the ceiling and name the engine’s own. Spellings cross hosts, a position or an identity never does (authority-tables). - The access is walked before matching. A grant of
read: [`home sandbox]is not escaped by a~/sandbox/leak → /etc/passwdlink the body plants once the grant has taken force: the walk lands on/etc/passwd, which is outside the region and denied. This is a time-of-check-to-time-of-use race whose use is theopen(); the open goes through the handle the walk holds.
So the runtime fold judges a transcript against the resolved layers: expand →
anchor → walk → RealPath::contains or Excluded::matches, per access
(path-judgment). This is the access-time complement
to the decode-time resolution — the same reason the runtime fold stays
a live judgment and not a precomputed value.
Resolving the rule’s anchors pins its authorship: `cwd resolves to where
the grant was established, so a later cd cannot retroactively widen authority.
Allowances name what they named. A grant reading work/ro and writing
work is not escaped by renaming ro and planting a symlink named ro that
points outside: the allowance keeps its position, the guard judges by it, and
each backend refuses a launch whose allowance’s position now meets a link or
reparse point rather than following it (open_nofollow). Creating a granted
directory after the grant, or rm -rf dir && mkdir dir, keeps working: these
are path grants, not inode pins. Position is right for allowances and identity
is right for exclusions (one-path).
The XDG-escape guard is a per-profile invariant
Because freeze runs once per profile as it loads, the escape check fires on
any input profile that names an xdg-* place resolving outside HOME —
whether or not later composition would keep that path. A restrict profile that
mentions an escaping `xdg-data is rejected even if a meet would have
intersected it away.
The guard asks its containment question of the traces the walks reached — the
fs rules authorise objects, so it asks RealPath::contains, the predicate
every allowance speaks through, of the xdg place’s trace and of HOME’s.
Asking it of the surface spelling instead read XDG_DATA_HOME=~/link, with
link → /etc, as contained: the surface stayed under HOME while the
position the walk reached — the only one fs enforcement ever sees — was
/etc.
A freeze guard and an in-process guard that judge different forms of the same
prefix do not guard it. The general rule is
grants judge objects: every authority is
judged on what the walk reached, and the choice is made once inside
core/src/path/, where the containment kernel stays; each authority reaches it
through RealPath::contains or Excluded::matches. No caller elsewhere holds
two paths and picks.
This is fail-closed: the honest reading for a defence-in-depth control is that
the offending input is refused at the boundary, not that its rejection depends on
what survives the lattice. Error attribution is per-profile — exarch’s loader
prepends --restrict <path> (or --extend), so the message names the file
that carried the bad token.
A `gitdir pointer is answered, not obeyed
Two places read a source the session does not author — an XDG_*_HOME and a
.git pointer file — and each is guarded in the terms of whoever could write
it. The xdg-* guard is containment, because an environment variable’s harm is
where it lands. The gitdir guard cannot be: a linked worktree’s git directory
legitimately lies outside the tree, so no region bounds it. What bounds it is
mutual reference.
- A
.gitfile lives in the working tree, which under exarch’sreasonablebase is granted for write. So the pointer is a sentence the confined body may compose, and`gitdiris granted read and write. - Freeze therefore follows the pointer only as far as a git directory that names
this tree back — a linked worktree’s
gitdirfile, orcore.worktreein the config of a repository split off with--separate-git-dir, the two records git itself keeps. Both ends must agree, and only one end is writable from inside the tree. - A pointer nothing claims is an
Errorat the boundary (bad_pointerinauthority::grant::freeze, which holds the threegitdirrefusals), like an escapingxdg-*place. Silently narrowing to the cwd would be safe and unreadable — the same fail-closed-and-say-so reading the XDG guard takes.
Composition is over resolved paths
Each profile is resolved as it loads, and the lattice operations run on the
resolved layers. Only --extend merges: exarch builds one ceiling,
base ◁ extend, and then pushes each --restrict file as a layer of its own
(policy); apply_session_profiles likewise pushes one
layer per --capabilities file.
- the meet and the extension compare resolved positions, so prefix containment is exact
(
/work/proj/src ⊂ /work/projis seen as such). Strictly more precise than comparing place spellings; no soundness change. - the
FreezeCtxis built once per composition site, home and cwd in hand — inline grants andapply_session_profilesuseShell::freeze_ctxfor the live environment, cwd and scratch; exarch’sfor_invocationsupplies its launch anchor directly.
The resolved layers and the runtime fold are then two fidelities of one
algebra — over the positions and objects resolved at decode here, over the
transcript of the access’s own walk at enforcement time — sharing one meet,
Table::meet (authority-tables), but kept apart
deliberately:
exec-authority-partitioned
§“one combinator at two fidelities” and §“the two folds stay separate”.
Composition itself is stacking, not a fold over frozen values: the
GrantStack holds each layer and every judgment meets the layers’
evidence at the access (object-not-name).
Off the wire by construction
GrantLayer and GrantStack derive Serialize / Deserialize, and the stack
crosses to a re-exec’d child or a guest engine as its traces: an exclusion’s
Hold serialises as its trace and deserialises unheld, and the receiver calls
GrantStack::rehold, which walks each exclusion again and holds the object
where it is still the one recorded. A codec is pure; a stack that is not
root() is dispatched to a local engine only, since a position resolved on one
host means nothing on another.
A spelling means something in some namespace, and one carrier crosses to a
different one: synod’s grant is spelled on the host and enforced by the
in-process guard inside a Linux guest, so it names /work and /tmp and is
folded by the guest’s rule, not this process’s
(guest-namespace-prefixes — a
Windows host folding /work with Path::components rebuilds it as \work).
The guest resolves the spelling there, so a position is always resolved in the
namespace the guard matches in.
See also grant (the calculus this resolves into), two-enforcers, authority-is-belnap-evidence (allowances by position, exclusions by object), capability-stage-collapse (the decision to collapse to one always-frozen type), reduced-authority-witness, system-c (the type-based pole), and map: capabilities.