Repository navigation
feat: pluggable sandbox backends: bwrap, Landlock, macOS sandbox-exec - #4
Merged
Merged
Conversation
The :sandbox spec (paths, environment, network) stays as it is; what enforces it is now chosen by parenting-sandbox-backend: bwrap (the default on GNU/Linux, unchanged), landlock through the landrun launcher, sandbox-exec (the default on macOS) with a deny-by-default Seatbelt profile, or a function returning the command prefix. Landlock and Seatbelt grant paths in place, so a (SRC . DEST) remapping stays bwrap only and is an error there, and an ungranted path can still be probed for existence but not read, listed or written. Both clear the environment to HOME, the baseline, and the named pass-through variables; parenting-spawn now creates HOME and TMPDIR under the socket directory for every backend. Landlock restricts TCP, not UDP. Tests cover the dispatch, both new command builders, and a live Landlock child that answers over the socket, has a writable HOME, does not see an unpassed variable, and is refused a file outside its grants. The sandbox-exec backend is tested as generated text only; it has not been run on macOS. Co-Authored-By: Claude Opus 5.5 <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.
The
:sandboxspec (paths, environment, network) stays as it is; what enforces it is now chosen byparenting-sandbox-backend:bwrap, the default on GNU/Linux, unchanged.landlock, Landlock through the landrun launcher (parenting-sandbox-landlock-program). No namespaces, so it works where unprivileged user namespaces are disabled.sandbox-exec, the default on macOS: a deny-by-default Seatbelt profile, withparenting-sandbox-exec-extra-rulesfor rules a child turns out to need.Landlock and Seatbelt grant paths in place, so a
(SRC . DEST)remapping stays bwrap only (an error on the others), and an ungranted path can still be probed for existence (stat,access) but not read, listed or written. Both clear the environment to HOME, the baseline, and the named pass-through variables.parenting-spawnnow creates HOME and TMPDIR under the socket directory for every backend. Landlock restricts TCP, not UDP.Tests: the dispatch, both new command builders, and a live Landlock child that answers over the socket, has a writable HOME, does not see an unpassed variable, and is refused a file outside its grants. Locally, with landrun 0.1.15 on Linux 7.2, all 62 tests pass, both live sandbox tests included; in CI the live Landlock test skips when landrun is absent. The sandbox-exec backend is tested as generated text only and has not been run on macOS.
🤖 Generated with Claude Code