# Sandbox profile ordering and git compatibility Status: accepted ## Context Both backends build a "hide $HOME, then re-allow" policy. Git is run inside the sandbox and is picky about what it can stat and read. ## Decision - Paths are canonicalised after lexical `..`/`.` removal, so a non-existent prefix cannot hide an escape from the project dir. - bwrap: hide `$HOME` and `/tmp` first, then mount back the allowed paths; later mounts win. - seatbelt: the last matching rule wins, so hide `$HOME` first and re-allow after. - Git resolves paths component by component and dies on EPERM, so the sandbox grants metadata-only `stat` (`literal`: the directory itself, not its contents) on `$HOME` and every directory above an allowed path. - Files named by `[include]`/`[includeIf]` in the global git config are made readable (followed a few levels), and the `gitdir:` directories of `includeIf` get metadata access, because git resolves them on every start and fails to start without them. ## Consequences Rule order is load-bearing and must not be reshuffled. Git config includes expand the readable surface slightly. Code: crates/hx-core/src/sandbox.rs (path canonicalisation, git include scan, bwrap args, seatbelt profile)