Skip to content

formula_creator: add deny network to some modes - #23730

Merged
cho-m merged 1 commit into
mainfrom
formula_creator-deny-network
Sep 1, 2026
Merged

formula_creator: add deny network to some modes#23730
cho-m merged 1 commit into
mainfrom
formula_creator-deny-network

Conversation

@cho-m

@cho-m cho-m commented Sep 1, 2026

Copy link
Copy Markdown
Member

When creating a new formula, add deny_network_access! to the following modes:

  • :cmake - has been default via trap_fetchcontent_provider.cmake
  • :meson - has been default via --wrap-mode=nofallback
  • :perl - build and test dependencies are provided via resources
  • :autotools - these are pre-generated configure scripts and we typically want to prevent network here given prior security incidents
  • nil - if unknown, start without network access as safer default

Others can be added after we check if fetching works.

Also fix typo in resources portion as || :python || :ruby was always true and drop :python which is handled via update-python-resources


  • 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.

n/a


Add `deny_network_access!` to the following modes:
* `:cmake` - has been default via trap_fetchcontent_provider.cmake
* `:meson` - has been default via `--wrap-mode=nofallback`
* `:perl` - build and test dependencies are provided via resources
* `:autotools` - these are pre-generated configure scripts and we
  typically want to prevent network here given prior security incidents
* `nil` - if unknown, start without network access as safer default

Others can be added after we check if fetching works.

Also fix typo in resources portion as `|| :python || :ruby` was always
true and drop `:python` which is handled via update-python-resources
Copilot AI balanced review requested due to automatic review settings September 1, 2026 18:22

@MikeMcQuaid MikeMcQuaid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds safer default network restrictions to generated formula templates and corrects resource placeholder selection.

Changes:

  • Adds deny_network_access! for Autotools, CMake, Meson, Perl, and generic templates.
  • Limits resource placeholders to Perl and Ruby templates.
  • Adds template-generation coverage for affected modes.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
Library/Homebrew/formula_creator.rb Updates generated formula template behavior.
Library/Homebrew/test/formula_creator_spec.rb Tests network and resource template output.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@cho-m
cho-m added this pull request to the merge queue Sep 1, 2026
Merged via the queue into main with commit 74d6ac5 Sep 1, 2026
60 checks passed
@cho-m
cho-m deleted the formula_creator-deny-network branch September 1, 2026 20:37
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.

3 participants