What happened:
I'm seeing that when providing your own package details and alpine distro version details independent of an image, the distro patch version being left off may result in incorrect results:
❯ echo "pkg:apk/openssh@9.6_p1-r1" | grype purl:/dev/stdin --distro 'alpine:3.19.4' -q
No vulnerabilities found
❯ echo "pkg:apk/openssh@9.6_p1-r1" | grype purl:/dev/stdin --distro 'alpine:3.19' -q
NAME INSTALLED FIXED-IN TYPE VULNERABILITY SEVERITY
openssh 9.6_p1-r1 9.8_p1-r0 apk CVE-2024-6387 High
The results with --distro 'alpine:3.19.4' is correct/expected: this is a valid secdb entry that should prune the NVD match from results entirely.
What appears to be happening is that when the patch version is not specified this is using the alpine:distro:alpine:edge namespace to search against instead of alpine:distro:alpine:3.19 which has a different package fix version entirely (thus won't be pruned).
What you expected to happen:
Using grype with this purl with both --distro 'alpine:3.19.4' and --distro 'alpine:3.19' should have the same result: CVE-2024-6387 should be absent from the results.
What happened: I'm seeing that when providing your own package details and alpine distro version details independent of an image, the distro patch version being left off may result in incorrect results:
Please take note the vuln info for this record:
The results with
--distro 'alpine:3.19.4'
is correct/expected: this is a valid secdb entry that should prune the NVD match from results entirely.What appears to be happening is that when the patch version is not specified this is using the
alpine:distro:alpine:edge
namespace to search against instead ofalpine:distro:alpine:3.19
which has a different package fix version entirely (thus won't be pruned).What you expected to happen: Using grype with this purl with both
--distro 'alpine:3.19.4'
and--distro 'alpine:3.19'
should have the same result:CVE-2024-6387
should be absent from the results.