Repository navigation
fix(sandbox): let /bin/sh read / on macOS 26; report signal-killed commands - #231
Merged
Merged
Conversation
Collaborator
Author
|
Profile rule confirmed on macOS 26: the |
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.
Bug
On macOS 26 (Darwin 25.6) every sandboxed
bash_execcall returnssuccess:false, exitCode:nullwith empty output and no error. Kernel log:Sandbox: sh deny(1) file-read-data /./bin/shreads the root directory at startup; the seatbelt profile is(deny default)and only ever grantsfile-read-metadataon/, so sh aborts (SIGABRT, 134) before running anything. Reporter's repro:sandbox-exec -p '(version 1)(allow default)(deny file-read-data (literal "/"))' /bin/sh -c 'echo hi'.A signal death has no exit code, and nothing recorded the signal, so the failure was invisible.
Fix
macos_seatbelt.rs:(allow file-read-data (literal "/"))after(deny default). Root directory listing only; no subpath. The workspace mask (a folder inside $HOME, emitted last) cannot undo it. Test pins the rule and rejects(subpath "/").runner.rs: on unix, a signal-killed child getsprocess terminated by signal Nappended to stderr, after truncation so it is never cut off. No new fields; bindings unchanged. Timeouts return earlier and are unaffected.+14/−4 production, +55 tests. Independent review: production_quality (
reviews/macos-seatbelt-root-read-review-r1.mdin the manager workspace); both minors fixed.Not verified
No macOS available here. On macOS 26 this should confirm it:
sandbox-exec -p '(version 1)(allow default)(deny file-read-data (literal "/"))(allow file-read-data (literal "/"))' /bin/sh -c 'echo hi'printshi; without the last rule it aborts with 134.