google / osv.dev

Open source vulnerability DB and triage service.
https://osv.dev
Apache License 2.0
1.49k stars 186 forks source link

fix(nvd-cve-osv): handle the edge case of a valid repo reference #2678

Open andrewpollock opened 9 hours ago

andrewpollock commented 9 hours ago

The repo caching validates repos are usable for tag to commit mapping (i.e. they have tags) before adding them.

It's possible that a CVE has a commit reference for a repo with no tags (but it's usable as-is because we assume the commit is a Fixed commit).

These repos were not being added to the repo cache, but the repo cache was being used as a short cut by subsequent calls to ReposFromReferences(), overwriting the internal state on what repos were known for a CVE with multiple CPEs.

This meant that for CVE-2024-45313, which has multiple CPE entries:

This meant that CVE-2024-45313 initially successfully converted before the NVD analyzed it, but started failing to convert after the NVD added CPEs.