Files
hx/docs/adr/0016-sandbox-profile-ordering-and-git.md
T
johannesandClaude Sonnet 5.5 a94632ea3d chore: delete code comments, add ratchet lint and ADRs
Classify every comment as tautology, stale, excuse or decision record.
Tautology/stale/excuse comments are deleted (excuses filed as issues
#196-#236), decisions moved to docs/adr/0001-0034.

- scripts/lint-comments.sh + .comment-baseline: per-file comment count
  may only go down; wired into tests/all.sh
- .claude/skills/delete-comment: repeatable audit workflow
- cargo fmt applied to touched crates

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-21 13:37:32 +01:00

19 lines
1.2 KiB
Markdown

# 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)