Repository navigation
fix(curation): a pypi version rule holds every spelling of the release - #525
Merged
Merged
Conversation
A pypi proxy matched a rule's version pattern against the version exactly as
the file name spells it, while pip reads many spellings as one version. A
block rule for 2.0.0 left the files spelled 2.0, 2.0.0.0, 02.0.0 and v2.0.0
on the project page and downloadable, and the local build 2.0.0+x, which
"==2.0.0" also selects (and prefers), as well.
curation.Set now matches a pypi version in more than one form: the spelling,
its lowercase (PEP 440 ignores case), its canonical form
(pyversion.Canonical) and, for a local version, the canonical public
version. A plain version pattern is put in canonical form when the set is
built, so it matches every spelling of the release and its local builds; a
local pattern ("2.0.0+cpu") that build only. A glob is lowercased and
matched against the spelling and the canonical form: "2.0.*" keeps
matching 2.0.0 and 2.0.5 through their spelling although the canonical form
drops trailing zeros, and does not cover a release spelled "2.0" (canonical
"2"); the docs say to add the plain rule for that. A block on any form
still beats an allow. Other formats compare versions as before.
Every path goes through Set.Evaluate (Gate.Hidden): the project page filter,
file downloads, and both availability checks. The single check
(explainProxy) now also takes the spelling from the cached project page, as
the batch does since #488, so a glob written against the file spelling
("0.6c*") holds the version a lockfile names ("0.6rc11") in both; before,
the batch said held and the single check available.
Tests: the spelling, local-version, glob and allowlist cases in curation (18
of them fail without the fix); the report reproduced through the pypi proxy
(page and downloads); the single and batch checks agreeing on 0.6rc11.
GHSA-8483-q77r-q9xm
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Coverage
Go by area
Web by area (lines)
|
Merged
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.
Fix for GHSA-8483-q77r-q9xm (reported by @orcamedia), from the advisory's private fork PR. Released in v0.25.1.