Repository navigation
Recognize legacy PyPI resource URLs - #24142
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The change is narrowly scoped and covered by tests; the remaining issue is only a minor nit.
Review effort: Lite
Findings: None
What changed in this PR
Updates vulnerability matching to recognize legacy pypi.python.org resource URLs used by older formula revisions.
Changes:
- Supports both current and legacy PyPI hosts.
- Adds coverage for hashed, source, and wheel URLs.
| File | Summary |
|---|---|
Library/Homebrew/vulns/identify.rb |
Expands PyPI URL matching. |
Library/Homebrew/test/vulns/identify_spec.rb |
Tests legacy URL handling. |
Review note (nit): Split the legacy-wheel assertion into a separate example.
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
p-linnane
force-pushed
the
advisory-legacy-pypi-urls
branch
from
October 1, 2026 01:48
057bd81 to
d637eed
Compare
dduugg
approved these changes
Oct 1, 2026
dduugg
left a comment
Member
There was a problem hiding this comment.
Thanks! One small non-blocking edge case inline.
Older formula revisions download PyPI resources from pypi.python.org rather than files.pythonhosted.org. `registry_purl` only matched the newer host, so history walks treated those revisions as not shipping the package and set `introduced` too late: gitup's GitPython advisories started at 0.4.1, its first revision on the new host, instead of 0.2.3. Both hosts serve the same `packages/<a>/<b>/<hash>/` and `packages/source/<letter>/<name>/` layouts, so accept either host. Strip URL fragments first: some legacy URLs carry an `#md5=` digest, which would otherwise end up in the version or let a wheel past the extension check. Signed-off-by: Patrick Linnane <patrick@linnane.io>
p-linnane
force-pushed
the
advisory-legacy-pypi-urls
branch
from
October 1, 2026 04:28
d637eed to
5302dbf
Compare
p-linnane
enabled auto-merge
October 1, 2026 04:29
MikeMcQuaid
approved these changes
Oct 1, 2026
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.
Vulns::Identify.registry_purlonly recognizedfiles.pythonhosted.orgresource URLs, but formula revisions from before 2018 download PyPI resources frompypi.python.org. History walks treated those revisions as not shipping the package, so matched advisories started too late. Both hosts use the samepackages/<a>/<b>/<hash>/andpackages/source/<letter>/<name>/layouts, so this accepts either host.To reproduce,
brew advisory-match --json gitup | jq -r '.[] | select(.id == "BREW-gitup-CVE-2026-87817") | .affected[0].ranges[0].events'givesintroduced: 0.4.1onmain, which is gitup's first revision on the new host. With this change it gives0.2.3, the formula's first version, which already bundled GitPython 1.0.1.Fresh record generation can now fail closed instead of emitting a boundary when older revisions become visible. legit's
0.1.0label covers both a binary with no declared GitPython resource and a mislabelled 0.2.0 build that declares one, so new legit GitPython candidates report "affected introduction cannot be established" rather than starting at 0.2.1. That is the existing safeguard working as intended. Ordinary ingest preserves existing reviewed introductions, so this neither corrects already-published records nor stops their metadata updates; those need explicit correction.brew benchmarkresults.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?Claude Code found this while independently verifying Homebrew/advisory-database Ingest output against full homebrew-core history, then wrote the change and specs and compared
brew advisory-matchoutput for gitup and legit with and without it. I reviewed the diff and the before/after results.