Skip to content

Require explicit internal package source loading - #24442

Open
MikeMcQuaid wants to merge 1 commit into
migrate-cask-source-loadsfrom
secure-package-loader-defaults
Open

MikeMcQuaid wants to merge 1 commit into
migrate-cask-source-loadsfrom
secure-package-loader-defaults

Conversation

@MikeMcQuaid

Copy link
Copy Markdown
Member
  • Restrict default formula and cask lookup to names, with explicit APIs for audited path, bottle and content loading.
  • Remove the internal environment override and make the old path restriction setting a no-op, including for developers.
  • Deprecate retired loader entry points without restoring source evaluation when notices are suppressed.
  • Cover rejection of implicit paths, source and installed fallbacks, and document the supported internal loading APIs.

  • Have you followed our Contributing guidelines?
  • 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 Astra at High effort, with local review and testing.


@MikeMcQuaid
MikeMcQuaid added this pull request to stack #24440 November 2, 2026 08:57
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

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: 3469e07b-db2b-4e90-8998-9370aad178ca
Commits

Reviewing files that changed from the base of the PR and between 439bc43 and 44f93e4.

Files selected for processing: 6
  • Library/Homebrew/cask/cask_loader.rb
  • Library/Homebrew/formulary.rb
  • Library/Homebrew/test/loader_deprecations_spec.rb
  • Library/Homebrew/test/path_loading_spec.rb
  • Library/Homebrew/utils/path.rb
  • docs/Homebrew-Package-Policies.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

Summary

Summary by CodeRabbit

  • Behaviour Changes

    • Formulae and casks can no longer be loaded through local paths, including in developer mode. Loading by package name remains available.
    • Implicit path- and URL-based loading is no longer supported. Deprecated loading methods may show notices or return errors; explicit source-loading methods remain available where supported.
    • Removed casks raise an unavailable error by default instead of loading from installed metadata.
    • HOMEBREW_FORBID_PACKAGES_FROM_PATHS no longer affects whether local packages can be loaded.
  • Documentation

    • Updated package policy and command-line documentation to explain the local-path restriction and the setting’s no-op status.

Formula and cask lookup now uses package names instead of implicit paths, URLs, source strings, or object references. Path-based package loading is disabled, including in developer mode. Explicit source-loading methods remain available, and legacy loader entry points are deprecated or restricted.

Changes: Package loading

Layer / File(s) Summary
Disable package-path loading
Library/Homebrew/env_config.rb, Library/Homebrew/utils/path.rb, Library/Homebrew/brew.sh, Library/Homebrew/test/path_loading_spec.rb, Library/Homebrew/test/utils/path_spec.rb, Library/Homebrew/test/env_config_spec.rb, docs/Homebrew-Package-Policies.md, docs/Manpage.md, manpages/brew.1
The path-loading setting is now a no-op, and loadable_package_path? always returns false. Tests and documentation reflect the restriction.
Formula name lookup and source loading
Library/Homebrew/formulary.rb, Library/Homebrew/formula.rb, Library/Homebrew/extend/os/linux/system_config.rb, Library/Homebrew/test/formulary_spec.rb, Library/Homebrew/test/loader_deprecations_spec.rb, Library/Homebrew/test/path_loading_spec.rb
Formula loader selection uses names. Implicit path, URL, cache, and keg discovery is removed or deprecated. factory no longer accepts from:; keg lookup retries an unqualified name and can fall back to the keg’s .brew file.
Cask name lookup and installed-file loading
Library/Homebrew/cask/cask_loader.rb, Library/Homebrew/test/cask/*, Library/Homebrew/test/support/helper/cask.rb, Library/Homebrew/test/loader_deprecations_spec.rb, Library/Homebrew/test/path_loading_spec.rb
Cask loader selection uses names. Installed-file loading checks the recorded metadata path. Legacy selectors and URL loading are deprecated or restricted.
Merge Risk: Minimal · up to 44f93

The previously reported lookup and documentation issues appear corrected. No actionable merge-blocking risk is established.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: requiring explicit internal package source loading.
Description check Passed The description directly explains the changes to formula and cask lookup, path restrictions, loader deprecations, tests, and documentation.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

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.

Share

Comment thread docs/Homebrew-Package-Policies.md Resolved
Comment thread Library/Homebrew/formulary.rb Resolved
@MikeMcQuaid
MikeMcQuaid force-pushed the secure-package-loader-defaults branch from c49691c to 809a085 Compare November 2, 2026 13:24
@MikeMcQuaid
MikeMcQuaid force-pushed the secure-package-loader-defaults branch from 809a085 to 813d0ad Compare November 2, 2026 14:56
@MikeMcQuaid
MikeMcQuaid force-pushed the secure-package-loader-defaults branch from 813d0ad to be0985d Compare November 2, 2026 15:22
@MikeMcQuaid
MikeMcQuaid force-pushed the secure-package-loader-defaults branch from be0985d to 439bc43 Compare November 2, 2026 15:56
Comment thread Library/Homebrew/formulary.rb Resolved
- Restrict default formula and cask lookup to names, with private
  APIs for audited path, bottle and content loading.
- Remove the internal environment override and make the old path
  restriction setting a no-op, including for developers.
- Warn directly for unsupported references and retain deprecations
  for retired entry points, without restoring implicit loading.
- Reject legacy input types even when a formula name is cached.
- Cover rejection of implicit paths, source and installed fallbacks,
  and document the supported private loading APIs.
@MikeMcQuaid
MikeMcQuaid force-pushed the secure-package-loader-defaults branch from 439bc43 to 44f93e4 Compare November 2, 2026 16:49

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant