You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Explain root command and service ownership trust - #24457
Document that sudo brew trusts the prefix owner and anyone able to modify Homebrew's code to execute arbitrary commands as root.
Describe edits to bin/brew and loaded code taking effect before command-specific checks or switching to another account.
Include this guidance in services, as-brew-user, as-console-user and --prefix help, plus the shared manual description.
State that services started with sudo run as root by default unless another service user is configured.
Describe ownership transfer as changing selected service paths and retain the warning about manual removal during package maintenance.
Explain that ownership changes to selected paths retain trust in accounts that can still modify the Homebrew installation.
Expand docs/FAQ.md, docs/Formula-Cookbook.md and docs/Installation.md with the prefix owner trust model and an example of modifying the brew entry point.
Have you checked for other open Pull Requests for the same change?
Have you explained what your changes do? Performance claims (e.g. "this is faster") must include brew benchmark results.
Have you explained why you'd like these changes included, not just what they do?
For bug fixes, have you given step-by-step brew commands to reproduce the bug?
Have you written new tests (excluding integration tests)? Here's an example.
Have you successfully run brew lgtm (style, typechecking and tests) locally?
I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.
Codex with GPT 6.1 Sol at Extra High effort, with local review and testing.
Review was skipped as selected files did not have any reviewable changes.
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: e8b5b6f0-4531-470c-b142-b2599fc246be
Commits
Reviewing files that changed from the base of the PR and between 3e00149 and 4354d12.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
Documentation
Expanded warnings across Homebrew commands and documentation to clarify that running brew with sudo trusts the Homebrew prefix owner and anyone able to modify Homebrew’s code to execute code as root.
Clarified that services started with sudo run as root unless configured otherwise, and that service software must also be trusted.
Added guidance on using brew services without sudo when root privileges are unnecessary.
The change adds sudo trust warnings to Homebrew command descriptions and documentation. It also expands root-service warnings and updates tests to check the service messages.
Changes: sudo and root-service warnings
Layer / File(s)
Summary
General sudo trust warning Library/Homebrew/manpages/brew.1.md.erb, docs/Manpage.md, manpages/brew.1, docs/FAQ.md, docs/Installation.md
The general brew documentation and FAQ state that sudo brew can run code as root before command checks or account switches.
The --prefix, as-brew-user, and as-console-user descriptions and manpage entries explain the prefix-owner trust associated with sudo.
Root-service warnings and validation Library/Homebrew/cmd/services.rb, Library/Homebrew/services/cli.rb, Library/Homebrew/test/services/cli_spec.rb, docs/Formula-Cookbook.md, docs/Manpage.md, manpages/brew.1
Service command text and documentation describe root execution and the trust required when Homebrew services run as root. Tests check the updated warnings.
Merge Risk: Minimal · previous review 3e001
The PR adds consistent sudo and root-service trust warnings without an evidenced behavioral regression.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "Explain root command and service ownership trust" matches the changeset. The PR adds warnings to help text, manpages and docs that running brew with sudo trusts the prefix owner to run code…
Description check
The description is related to the changeset. It lists the sudo trust warning, the affected commands (services, as-brew-user, as-console-user, --prefix), the manual and FAQ updates, and the service roo…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "Explain root command and service ownership trust" matches the changeset. The PR adds warnings to help text, manpages and docs that running brew with sudo trusts the prefix owner to run code as root, and it covers service root ownership. The title names the main theme, though it does not name the specific docs and help text changes.
Full details: Description check
Explanation
The description is related to the changeset. It lists the sudo trust warning, the affected commands (services, as-brew-user, as-console-user, --prefix), the manual and FAQ updates, and the service root-ownership behaviour. It is detailed and on-topic. Some bullets repeat each other, but this does not make it off-topic.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: aa6d4593-b5b5-44c2-bca9-51dbeca8d2e5
Commits
Reviewing files that changed from the base of the PR and between fad7cba and 3e00149.
Files selected for processing: 12
Library/Homebrew/cmd/--prefix.rb
Library/Homebrew/cmd/as-brew-user.rb
Library/Homebrew/cmd/as-console-user.rb
Library/Homebrew/cmd/services.rb
Library/Homebrew/manpages/brew.1.md.erb
Library/Homebrew/services/cli.rb
Library/Homebrew/test/services/cli_spec.rb
docs/FAQ.md
docs/Formula-Cookbook.md
docs/Installation.md
docs/Manpage.md
manpages/brew.1
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
- Document that `sudo brew` trusts the prefix owner and anyone able to
modify Homebrew's code to execute arbitrary commands as root.
- Describe edits to `bin/brew` and loaded code taking effect before
command-specific checks or switching to another account.
- Include this guidance in `services`, `as-brew-user`, `as-console-user`
and `--prefix` help, plus the shared manual description.
- State that services started with `sudo` run as root by default unless
another service user is configured.
- Describe ownership transfer as changing selected service paths and
retain the warning about manual removal during package maintenance.
- Explain that ownership changes to selected paths retain trust in
accounts that can still modify the Homebrew installation.
- Expand `docs/FAQ.md`, `docs/Formula-Cookbook.md` and
`docs/Installation.md` with the prefix owner trust model and an
example of modifying the `brew` entry point.
- Regenerate the Markdown and roff manuals from their sources.
- Extend service message coverage and run command and manpage tests
alongside type, style and documentation checks.
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
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.
sudo brewtrusts the prefix owner and anyone able to modify Homebrew's code to execute arbitrary commands as root.bin/brewand loaded code taking effect before command-specific checks or switching to another account.services,as-brew-user,as-console-userand--prefixhelp, plus the shared manual description.sudorun as root by default unless another service user is configured.docs/FAQ.md,docs/Formula-Cookbook.mdanddocs/Installation.mdwith the prefix owner trust model and an example of modifying thebrewentry point.brew benchmarkresults.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?Codex with GPT 6.1 Sol at Extra High effort, with local review and testing.