feat(sandbox): macOS seatbelt strategy for the Bash tool#120
Merged
emal-avala merged 3 commits intomainfrom Apr 15, 2026
Merged
feat(sandbox): macOS seatbelt strategy for the Bash tool#120emal-avala merged 3 commits intomainfrom
emal-avala merged 3 commits intomainfrom
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
First vertical slice of ROADMAP §7.4 Process-Level Sandboxing. Ships a SandboxStrategy trait with a macOS Seatbelt implementation, wires it into the Bash tool's subprocess spawn path, and exposes a --no-sandbox CLI flag and /sandbox slash command. Shipped: - crates/lib/src/sandbox/ module (trait, Noop, policy, seatbelt) - SandboxConfig added to ConfigSchema; disabled by default while Linux and Windows strategies land - SandboxExecutor threaded through ToolContext; Bash wraps its tokio Command via ctx.sandbox before spawn - Honors dangerouslyDisableSandbox per-call, gated on security.disable_bypass_permissions - SBPL profile: deny default, broad reads, project-dir writes plus explicit allow list, forbidden-path deny-reads, optional network - Canonical-path resolution for subpath rules so /var <-> /private/var symlink redirection does not break project-dir writes - --no-sandbox CLI flag (gated on disable_bypass_permissions) - /sandbox slash command printing active strategy and resolved policy - Unit tests (17): policy expansion, strategy picker, profile generation - Integration tests (4): disabled pass-through, no-ctx pass-through, seatbelt blocks /etc writes, seatbelt allows in-project writes (macOS-gated) Deferred to follow-up PRs: Linux bwrap, Windows Low Integrity, secret file masking, per-tool overrides, agent/powershell wiring, enable-by- default once all three platforms are in.
The two macos-only integration tests are the only consumers, so the import is dead on Linux/Windows and clippy -D warnings rejects it.
a785a47 to
4856612
Compare
Adds 20 new unit tests (17 → 37) covering strategy picker branches, executor state combinations, SeatbeltStrategy argv/cwd/env preservation, profile edge cases (empty lists, multiple forbidden paths, process allow rules, system.sb import), and the from_session_config bypass path. Adds 5 new integration tests (4 → 9) that exercise bash.rs end to end: per-call dangerouslyDisableSandbox honors the session bypass flag and is ignored when security.disable_bypass_permissions is set, cwd is preserved through the sandbox-exec wrapper, explicit allowed_write_paths entries are honored, and broad reads of /etc/hosts remain allowed. Also fixes a real bypass-gate gap in bash.rs: the previous wiring did not consult disable_bypass_permissions at all. Adds SandboxExecutor::from_session_config and from_config_with_bypass so the gate flows through from config automatically. Adds e2e-tests.sh section M (4 tests): [sandbox] config section parse, --no-sandbox flag, unknown-strategy graceful fallback, macOS-gated serve-mode real sandbox deny check.
This was referenced Apr 15, 2026
Merged
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.
First vertical slice of ROADMAP §7.4 Process-Level Sandboxing — the top Critical v1.1 item. Adds real OS-level isolation to the Bash tool on macOS so that even a compromised agent cannot write outside the project directory or read credential files.
Summary
Deferred to follow-up PRs
Test plan