Add Linux Landlock sandbox - #23255
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an alternative Linux sandbox implementation using Landlock, intended to reduce reliance on Bubblewrap (notably in CI/container environments) while keeping the existing Bubblewrap sandbox as the default.
Changes:
- Introduces
Sandbox::Landlockand refactors Linux sandboxing to select between Landlock and Bubblewrap viaHOMEBREW_SANDBOX_LINUX_LANDLOCK. - Updates Linux diagnostics and dependency collection behaviour for the Landlock opt-in.
- Adjusts CI to enable Landlock and removes the container
--privilegedrequirement.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Library/Homebrew/test/sandbox_linux_spec.rb | Updates Linux sandbox specs for Bubblewrap class extraction and adds implementation-selection coverage. |
| Library/Homebrew/test/sandbox_landlock_spec.rb | Adds focused unit tests for Landlock availability, rule application, and command preparation constraints. |
| Library/Homebrew/test/os/linux/diagnostic_spec.rb | Ensures Linux diagnostics tests aren’t affected by the Landlock opt-in and adds a Landlock-unavailable diagnostic case. |
| Library/Homebrew/test/os/linux/dependency_collector_spec.rb | Covers dependency collector behaviour when Landlock is selected. |
| Library/Homebrew/sandbox.rb | Adds an apply_sandbox hook invoked in the child process before exec. |
| Library/Homebrew/extend/os/linux/sandbox/landlock.rb | Implements Landlock sandboxing (availability probing + rule application). |
| Library/Homebrew/extend/os/linux/sandbox/bubblewrap.rb | Extracts Bubblewrap sandboxing into its own class (previously embedded in Linux sandbox extension). |
| Library/Homebrew/extend/os/linux/sandbox.rb | Refactors Linux sandbox extension to delegate to the selected implementation and applies Landlock restrictions before exec. |
| Library/Homebrew/extend/os/linux/diagnostic.rb | Updates sandbox diagnostics to account for Landlock opt-in messaging. |
| Library/Homebrew/extend/os/linux/dependency_collector.rb | Avoids Bubblewrap dependency when Landlock is selected. |
| .github/workflows/tests.yml | Enables Landlock in CI and removes privileged container option. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
MikeMcQuaid
force-pushed
the
linux-landlock-sandbox
branch
8 times, most recently
from
July 22, 2026 13:19
d8a5abc to
11bd38d
Compare
MikeMcQuaid
marked this pull request as ready for review
July 22, 2026 14:07
p-linnane
reviewed
Jul 23, 2026
p-linnane
left a comment
Contributor
There was a problem hiding this comment.
This is looking great. A couple small things.
Bo98
approved these changes
Jul 23, 2026
MikeMcQuaid
force-pushed
the
linux-landlock-sandbox
branch
from
July 23, 2026 09:57
11bd38d to
38ede3f
Compare
MikeMcQuaid
force-pushed
the
linux-landlock-sandbox
branch
from
July 23, 2026 10:35
38ede3f to
bb95e74
Compare
7 tasks
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.
This may be a suitable substitute for Bubblewrap that'd be easier to use in e.g. CI environments.
brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?OpenAI Codex GPT 5.6 xhigh with local review and testing.