Home

mweinbach / agent-coworker

publicmweinbach/agent-coworker
Overview Code History Branches Pull requestsIssuesInsights
main
HomeOverview Code PRsIssues

fix(sandbox): canonicalize seatbelt writable roots like bwrap

4 months ago

0154b9b
Authored
Claude6/5/2026, 1:45:40 PM
Codex/Bugbot review (commit 65a4a6f): the macOS Seatbelt backend passed raw
writableRoots into -D params, while Linux bwrap resolves each root with realpath
before binding. A symlinked root could therefore point outside the intended
scope while Seatbelt granted writes on the logical path.

Extract bwrap's realpath-with-fallback as the shared canonicalizeRoot (in
policy.ts) and apply it to the seatbelt explicit roots before scratch dirs are
layered on. Scratch dirs stay literal; the macOS /tmp↔/private/tmp alias skip
still applies. Removes the duplicate canonicalize in bwrap.

Parent65a4a6f

4 files changed
  • src/platform/sandbox/bwrap.ts+7−11
  • src/platform/sandbox/policy.ts+10−0
  • src/platform/sandbox/seatbelt.ts+13−6
  • test/platform/sandbox.test.ts+26−0