harden(sandbox): H2 follow-ups — untrusted defaults, exec confinement, pin propagation - #362
Merged
Conversation
…finement, pin propagation Closes the follow-ups flagged when H2 (#359) merged: - HIGH-2: untrusted/unattended surfaces (channels, idle, heartbeat) now default to a confined `untrustedSurfaceMode()` instead of inheriting the local user's `danger-full-access` — capped at workspace-write where the host can enforce it (macOS Seatbelt / Linux bwrap), honouring a stricter env pin. Where no OS sandbox exists, bounded modes would fail closed and silently break autonomy, so it keeps the env default and warns once (loud "install bwrap" > broken heartbeat); an operator can force fail-closed everywhere with LISA_SANDBOX_MODE. - MED-3: `shell.exec` (argv form) now routes through `wrapArgvForSandbox`, the same fail-closed confinement as `run` — so ONE mode governs both shell halves. Previously grep/exec ran unconfined even under read-only/workspace-write. - Pin propagation: the web turn threads `chat.session.header.sandboxMode` (concurrent web sessions confine independently), and `task` (dispatched subagent) inherits `ctx.sandboxMode` so it can't escape its caller's sandbox. Tests: untrusted-surface mode capping (host-independent), argv pass-through when unconfined, and fail-closed/confine of a bounded argv. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the three follow-ups flagged when H2 (#359) merged (its comment lists them). H2's core — a pinned mode actually enforcing — is already in
main; this finishes the coverage. typecheck clean; full suite green (the one failing test is the knownmoodBusparallelism flake, passes in isolation).HIGH-2 — untrusted/unattended surfaces no longer inherit
danger-full-accesschannels(remote DMs),idle, andheartbeatnow default tountrustedSurfaceMode():workspace-write, honouring a stricter env pin (read-only).LISA_SANDBOX_MODE.(
idlealready runs a no-fs/shell subset and the mail/KB classifiers passtools: [], so this is defense-in-depth there and load-bearing forheartbeatfull-tool turns +unsafeFullToolschannels.)MED-3 —
shell.execnow confinedexec(argv form) routes through the newwrapArgvForSandbox— the same fail-closed path asrun, sharing one core (wrapProgram). Previouslygrep/execran unconfined even underread-only/workspace-write; now one mode governs both shell halves.Pin propagation (completes HIGH-1 coverage)
chat.session.header.sandboxMode, so concurrent web sessions confine independently of the process env.task(dispatched subagent) inheritsctx.sandboxMode— a subagent can't escape its caller's confinement.Tests
Host-independent: untrusted-surface capping, argv pass-through when unconfined, and confine/fail-closed of a bounded argv.
🤖 Generated with Claude Code