Skip to content

fix(scanner): fall back to a CVE alias when grype's primary id isn't one - #746

Open
haksungjang wants to merge 1 commit into
mainfrom
fix/grype-cve-alias-fallback
Open

fix(scanner): fall back to a CVE alias when grype's primary id isn't one#746
haksungjang wants to merge 1 commit into
mainfrom
fix/grype-cve-alias-fallback

Conversation

@haksungjang

Copy link
Copy Markdown
Member

Summary

  • docker/lib/scan-nvd-cpe.py dropped a grype match entirely whenever the primary vulnerability.id wasn't CVE-prefixed, even when a CVE-prefixed alias was listed under relatedVulnerabilities. Fall back to that alias instead of dropping.
  • Confirmed against a real supplier SBOM finding: grype returns Apache Kafka CVE-2024-27309 under the primary id BIT-kafka-2024-27309 (sourced from an Apache mailing-list advisory), with the CVE only in relatedVulnerabilities.

Test plan

  • tests/test-postprocess.sh (503 assertions, 0 failed) — new F-1f section stubs grype's binary to return both an aliased and a non-aliased non-CVE match, confirming the alias resolves and the non-aliased one still gets dropped
  • python3 -m py_compile docker/lib/scan-nvd-cpe.py
  • shellcheck --severity=warning tests/test-postprocess.sh (clean, matches CI's invocation)

grype sometimes assigns a non-CVE primary vulnerability id sourced
from a non-NVD advisory (e.g. an Apache mailing-list thread), with
the real CVE listed only under relatedVulnerabilities. The deep-cve
sidecar builder silently dropped these findings entirely instead of
checking for a CVE alias, losing real matches (confirmed against
Apache Kafka CVE-2024-27309 in a supplier SBOM).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant