Repository navigation
fix: compare CPython CPE versions using Python ordering - #3776
BarakStout wants to merge 3 commits into
Conversation
Signed-off-by: Barak Stout <barakstout@gmail.com>
Signed-off-by: Barak Stout <barakstout@gmail.com>
Signed-off-by: Barak Stout <barakstout@gmail.com>
|
Independent review at Reviewed the product/vendor/part and explicit-update guards, PEP 440 validation before overriding ecosystem comparison, and distro/wildcard fallback cases. Non-Python and OpenSSL letter-version behavior remains unchanged. Independently ran The change corrects version ordering; it does not change vulnerability data, package metadata, or suppression policy. |
Move the builder and final images to python:3.15.0 (trixie and alpine3.24) and the astral/uv tool images to 0.13.1-python3.15. All pins were checked against the registry with crane. Python 3.15.0 carries the fixes for CVE-2026-87910 (tarfile, python/cpython#157309), CVE-2025-15367 (poplib, #143924) and CVE-2026-12345 (tempfile, #158431), so their .grype.yaml entries go. Grype still reports CVE-2025-15367 against 3.15.0: NVD's bound is < 3.15.0a6 and grype's generic version ordering ranks the 3.15.0 final before that alpha. Keep a single ignore for it, scoped to python 3.15.0, until CI's grype includes anchore/grype#3776. Signed-off-by: Jürgen Kreileder <jk@blackdown.de>
|
Additional public reproduction supporting this CPython version-ordering fix: Grype v0.121.0 still reports CVE-2025-15367 for stable upstream CPython 3.15.0 through the direct-CPE/stock-matcher path, with no distribution package or vendor backport involved. docker run --rm anchore/grype:v0.121.0@sha256:621d56d1d68106b787022c81546f7e0a36202a25d1239f0c20195fab8c16f7ea \
'cpe:2.3:a:python:python:3.15.0:*:*:*:*:*:*:*' -o jsonObserved match:
Stable 3.15.0 is newer than alpha 6 under Python ordering. The public official The same CPE-only scan also returns two Bitnami-namespace matches; those have separate advisory/product-applicability concerns and are not attributed to this comparator fix. |
What does this PR do?
Use Python's existing PEP 440 comparator for recognized CPython application CPEs (
python:pythonandpython_software_foundation:python), independent of whether the interpreter was cataloged as a binary or a distribution package.CPython 3.15.0 is newer than 3.15.0a6, but the existing generic/APK comparison treats the final release as earlier than the letter-suffixed prerelease. That produces a false positive for CVE-2025-15367 with its NVD bound
< 3.15.0a6. The CNA record explicitly identifies the version type aspython.This changes comparison semantics for those CPython CPEs only. It does not modify package/CPE versions, vulnerability data, ignore rules or other products' comparison behavior. OpenSSL letter suffixes retain their existing meaning.
Testing
go test ./grype/matcher/internal ./grype/version -count=1passes.Checklist