Constraint-range advisory scan misses advisories introduced after the constraint floor #42
Labels
No labels
bug
contribution welcome
duplicate
enhancement
good first issue
help wanted
invalid
question
upstream
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Reference
marvin8/zaojun#42
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The constraint-range advisory scan (#39) fetches the version-level PyPI JSON response for the spec's lower bound only. Advisories that were introduced after the floor — vulnerable code shipped in a later release within the allowed range — do not affect the floor version, so they are invisible to the scan.
Concrete shape
Advisory introduced in 2.5, fixed in 2.11; latest release 2.12; dependency spec
>=2.3:==pin downstream) runs vulnerable code with no signal from zaojunThe "Known limitation" paragraph in
docs/usage/command-reference.mddocuments this gap.Impact
The scan answers "does my floor sit on vulnerable code?" but not "does my allowed range contain a vulnerable version my resolution could land on?". The missed class is narrower than the floor case (most advisories affect long-lived code present at the floor) but bites hardest for tight-capped ranges and pinned downstream builds.
Note: even with an improved probe (see follow-up), a mid-range island (introduced 2.5, fixed 2.7, newest allowed 2.8 and clean) remains missed; full closure requires OSV range data, which is a separate concern and a new external dependency.
Plan of attack (to implement after PR #41 merges, as a small stacked PR):
releases_map— versions satisfying the spec (SpecifierSet.contains), prereleases excluded unless the spec's own bound is a prerelease, take the max. Reuses_spec_includes_prereleases.==pins or single-release maps). Same fetch path, same cache namespace (package@version), same degrade-with-stderr-warning behaviour. Cost: one extra cached request per constrained package.suggest_flooralready generalises: an advisory withfixed_inabove the newest-allowed version yields a suggested floor that clears it, which is the correct remedy for this class.Open decisions to settle at implementation:
_spec_includes_prereleases— only probe prereleases the spec itself opts into.)--min-ageinterplay — lean: the probe ignoresmin-age; it selects advisories, not updates, and "your newest allowed version has an advisory" is precisely the supply-chain signalmin-ageusers want surfaced.