Add npm and pip cooldown defaults#21919
Conversation
706be94 to
46c6208
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces default “cooldown” behavior for dependency installation via npm and pip to reduce the chance of consuming very recently published packages, and adds unit test coverage for the new defaults.
Changes:
- Add
--min-release-age=1to npm install argument helpers inLanguage::Node. - Add a pip “uploaded prior to” cutoff (24h) to
Formula#std_pip_args. - Update
node_spec.rbandformula_spec.rbto assert the new default arguments.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| Library/Homebrew/language/node.rb | Adds npm cooldown flag to shared npm argument helpers. |
| Library/Homebrew/formula.rb | Adds pip cutoff argument and supporting time require. |
| Library/Homebrew/test/language/node_spec.rb | Updates Node helper tests for new npm args and stubs env setup. |
| Library/Homebrew/test/formula_spec.rb | Adds coverage for the new pip cutoff argument formatting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- delay new `npm` and `pip` packages by one day so freshly published compromises are less likely to land in builds - apply the `npm` cooldown in shared helpers so Node formula dependency installs inherit it too - cover the new defaults in `node_spec.rb` and `formula_spec.rb`
46c6208 to
6c02db3
Compare
| # Delay packages published in the last day so builds are less likely to | ||
| # install a freshly compromised PyPI release. | ||
| args << "--uploaded-prior-to=#{(time - (24 * 60 * 60)).iso8601(0)}" |
There was a problem hiding this comment.
This will only impact build-time packages when run in build-isolation. And nothing when no-build-isolation as we use --no-deps.
To cooldown a Python formula's dependencies, need to update the resource resolver:
brew/Library/Homebrew/utils/pypi.rb
Lines 510 to 515 in 7c387d9
EDIT: Though this may want to wait for bump support, i.e. #21888, so that the cooldown is applied to both main package and dependencies
There was a problem hiding this comment.
Yes, let's add there too.
Though this may want to wait for bump support, i.e. #21888, so that the cooldown is applied to both main package and dependencies
Let's not. Let's not perfect be the enemy of good here.
|
Sorry about the notification noise, but thank you for this change :) |
npmandpippackages by one day so freshly published compromises are less likely to land in buildsnpmcooldown in shared helpers so Node formula dependency installs inherit it toonode_spec.rbandformula_spec.rbbrew lgtm(style, typechecking and tests) with your changes locally?OpenAI Codex used with manual review and edits.