Files
hx/docs/adr/0017-sandbox-scope-and-fail-closed.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

1.1 KiB

Sandbox covers child processes only and fails closed

Status: accepted

Context

Bash, LSP servers, lens runners and test runners are spawned as child processes. File tools run inside the hx process, so a process-level sandbox cannot confine them. The hx process also holds the LLM API access and OAuth tokens and must stay outside the sandbox.

Decision

Every sandboxed spawn goes through sandbox::command, a drop-in for Command::new. With the sandbox off it is a plain command. With it on, the program runs under bwrap (Linux) or sandbox-exec (macOS): filesystem read-only except the project dir and rw, $HOME hidden except ro/rw, no network unless network, environment filtered. File tools call guard_read / guard_write themselves. If mode = on and no backend works, startup errors instead of silently running unsandboxed.

Consequences

In-process tools need explicit guards. A misconfigured host refuses to start rather than giving a false sense of safety.

Code: crates/hx-core/src/sandbox.rs (module doc, command, guard_read, guard_write, init)