fix: align macOS seatbelt sandbox with Codex whitelist policy#58
Merged
yishuiliunian merged 1 commit intomainfrom Apr 1, 2026
Merged
fix: align macOS seatbelt sandbox with Codex whitelist policy#58yishuiliunian merged 1 commit intomainfrom
yishuiliunian merged 1 commit intomainfrom
Conversation
The previous seatbelt profile used broad (allow sysctl-read), (allow mach-lookup), etc. which was both too permissive and simultaneously missing critical permissions (iokit-open, signal, pseudo-tty, ipc-posix-sem) that caused JVM/Bazel to crash inside the sandbox. Rewrite to a Codex-inspired whitelist approach: - Extract static rules into seatbelt_base.sbpl (include_str!) - Whitelist sysctl-read by prefix (hw.*, kern.os*, machdep.cpu.*) - Whitelist mach-lookup for ~20 specific system services - Scope signal and process-info to (target same-sandbox) - Limit iokit-open to RootDomainUserClient only - Add PTY device rules, ipc-posix-sem/shm, file-map-executable - Keep dynamic composition for file-read/write paths and network
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.
Summary
sandbox-execsandbox due to missingiokit-open,signal,pseudo-tty, andipc-posix-sempermissionssignal/process-infotosame-sandbox, whitelisted specificsysctl,mach-lookupservices, andiokitdevice classesseatbelt_base.sbplloaded viainclude_str!, keeping dynamic sections (writable paths, network) in RustChanges
crates/loopal-sandbox/src/platform/seatbelt_base.sbpl— new: static Seatbelt base policy (~110 lines)crates/loopal-sandbox/src/platform/macos.rs— rewritten to compose from.sbpl+ dynamic sectionscrates/loopal-sandbox/BUILD.bazel— addedcompile_datafor.sbplfilescrates/loopal-sandbox/tests/suite/platform_macos_test.rs— updated tests for new profile structureTest plan
bazel test //crates/loopal-sandbox:loopal-sandbox_test— PASSEDbazel build //crates/loopal-sandbox --config=clippy— zero warningssandbox-execwith new profile +bazel info— instant success