0215. Working macOS Seatbelt profile, toolchain roots and exec helper
- Status: Proposed (Mac escape and tool checks passed, review pending)
- Plan: M14.3;
implementation and Mac verification - Amends 0097 and decision 5 of 0213, not their other decisions.
Context
The workspace-rooted profile aborted even echo on macOS 26.6.2.
Crash reports showed dyld aborting during shared-cache discovery,
with Seatbelt denying read data on /. An otherwise
identical profile granting that literal directory started echo,
sh, and Python. ADR-0097 shipped untested. Linux snapshots cannot
establish Mac enforcement.
Decision
- Keep deny-default Seatbelt and explicit system read/map roots,
excluding
/System/Volumes/Datawithrequire-notto prevent firmlink reads. Grant metadata for proper ancestors and read data for the literal/directory so dyld can locate its shared cache. Keep narrow dyld/timezone/shell-selection reads, null/random/zero/dtracehelper device operations, read-only sysctl and signals confined to the same sandbox. Workspace reads include executable mapping. No broad HOME, tmp, mach-lookup or shared-memory grant. - Canonicalize roots before spawning. On macOS only,
workspace-rooted children start in that root and writable ones get
TMPDIR=<root>/. Root/keeps cwd and environment unchanged. PATH remains/usr/bin:/binon both hosts. [policy] sandbox_toolchainsis a closed set:xcode-selectdefault,homebrewopt-in,[]off; invalid/duplicate names produce E0845. Canonicalize the selected developer link, promoting.app/Contents/Developerto its bundle. Missing selection falls back to system-readable CLT. Reject volume roots and workspace ancestors. Resolve only listed Homebrew tool directories, never/opt/homebrew/var; ignore parent DEVELOPER_DIR.- Mac escape/startup proofs must pass before printing
sandbox: enforced seatbelt. Accept EPERM or EACCES denials. M14.3 remains open through review and merge. Darwin process-plugin launch now uses the private snapshot path in ADR-0229;18 focused process-plugin tests and the actual TUI highlighter pass on both backends on this Mac. Linux descriptor execution remains unqualified by this Mac run. - W7: under an app-scope lease, limited macOS interpreter runs
join its PGID through the prepared launcher's
--execmode. Command starts only our compiled Mach-O helper, never a user program. The helper uses execve and explicit PATH search, preserving argv[0] and returning ENOEXEC=8 without shell fallback (ADR-0087). No-lease runs keep subprocess. The helper is prepared once per program; this scoped path requires a C compiler and has serial error-file IO. - Bounded macOS interpreter runs use socket pairs for the pump's standard streams. The direct-exec launcher accepts the child endpoints as files. For process limits on both backends, a Darwin group-signal EPERM is considered complete only after retained identities and a full group snapshot prove the group has no live members. An unleased group retains its direct child leader; an authenticated borrowed lease additionally requires its separately retained broker witness (ADR0228). Signal the group and direct child before reaping. Preserve permission errors whenever proof is absent.
- On macOS, the tool registry checks that the configured
absolute command names an executable regular file before launching
through
sandbox-exec. The launch handshake otherwise confirms the wrapper before it tries the command. The registry handles subsequent child exits through its normal lifecycle checks. - Locked Darwin process plugins execute a private, verified
snapshot under Seatbelt rather than the original package path.
fs = "none"grants only the exact snapshot executable; the source package root is used for containment validation, not as a read grant. Optional toolchain subpaths are omitted from this profile. See ADR-0229 for the deadline, cleanup and relocation limits; focused Mac verification remains separate evidence.
Alternatives considered
- Import
system.sb: opaque grants vary with the OS and evade snapshots. sandbox_initafter fork: deprecated and not async-signal-safe.- External granted temp directories: introduce ownership/cleanup complexity.
- Wider PATH: changes existing golden output; use explicit Homebrew paths.
- Free-path toolchains: can authorize HOME; defer pending a capability design.
- Command on user programs: Darwin shell fallback violates ADR-0087.
Consequences
Read-only sandboxes cannot compile files. DNS with network enabled may need a narrow dnssd mach lookup; it remains unverified. sandbox-exec itself uses execvp: inside sandboxes, ENOEXEC may invoke a shell and missing commands exit 71. Those gaps stay in the parking lot. Linux policy, environment, cwd, existing goldens and default emitted-C digests stay unchanged. Mac verification and the required Sonnet review remain separate acceptance evidence, not Linux claims.