Harden sandboxed install phases#22413
Open
MikeMcQuaid wants to merge 1 commit into
Open
Conversation
- Reduce exposure to user home configuration during builds - Keep cask completion generation offline before running it - Mask denied read paths where the Linux sandbox can enforce them
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens sandboxed install/test phases by preventing access to the real user home directory where supported, using fake HOME directories, and keeping cask completion generation offline.
Changes:
- Adds sandbox APIs for read-deny rules and platform-specific support/masking.
- Applies
deny_read_hometo formula build/postinstall/test and cask sandbox flows. - Updates tests for denied read paths, Linux masking, installer sandbox stubs, and cask completion sandbox behavior.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
Library/Homebrew/sandbox.rb |
Adds read-deny rule helpers and deny_read_home. |
Library/Homebrew/extend/os/mac/sandbox.rb |
Detects macOS sandbox support for read-deny rules. |
Library/Homebrew/extend/os/linux/sandbox.rb |
Masks denied read paths in Bubblewrap arguments. |
Library/Homebrew/formula.rb |
Uses fake HOME for postinstall and threads fake HOME into shared build/test env. |
Library/Homebrew/formula_installer.rb |
Denies real HOME reads during sandboxed build/postinstall phases. |
Library/Homebrew/dev-cmd/test.rb |
Denies real HOME reads during sandboxed formula tests. |
Library/Homebrew/cask/artifact/abstract_artifact.rb |
Adds fake HOME and read-deny/network-deny behavior for cask sandbox commands. |
Library/Homebrew/test/sandbox_shared_spec.rb |
Tests shared sandbox read-deny rule creation. |
Library/Homebrew/test/sandbox_linux_spec.rb |
Tests Linux Bubblewrap masking for denied read directories. |
Library/Homebrew/test/formula_installer_spec.rb |
Updates installer sandbox test doubles for deny_read_home. |
Library/Homebrew/test/cask/artifact/generated_completion_spec.rb |
Updates cask completion sandbox tests for fake HOME/read-deny/offline ordering. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
$HOMEduring builds, we expose a fake one insteadbrew lgtm(style, typechecking and tests) with your changes locally?OpenAI Codex 5.5 xhigh with local review and testing.