Skip to content

feat(vulnfeeds): include CVSS v3 and v4 severities with source attribution - #6286

Open
jess-lowe wants to merge 1 commit into
google:masterfrom
jess-lowe:feat/cvss-v3-v4-severity-sources
Open

jess-lowe wants to merge 1 commit into
google:masterfrom
jess-lowe:feat/cvss-v3-v4-severity-sources

Conversation

@jess-lowe

@jess-lowe jess-lowe commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Overview

Previously, CVE conversion across vulnfeeds selected only a single highest-precedence CVSS vector per record (dropping CVSS v3 whenever CVSS v4 was present, and dropping competing NVD or CNA assessments for the same CVSS version) and discarded provenance, leaving severity[].source unset. However, the OSV schema (vulnerability.proto, schema.json), Go protobuf bindings (github.com/ossf/osv-schema/bindings/go/osvschema), storage backends (GCS protos, Datastore, PostgreSQL), public API, and website already fully support multiple severity entries and source attribution (osvschema.Severity_Source).

This PR updates NVD, CVE 5.0, and combined OSV conversion in vulnfeeds to retain one severity entry per (CVSS version, source) pair across CVSS v4 and CVSS v3 and populate severity[].source.


Key Changes

1. NVD Conversion (vulnfeeds/vulns)

  • Extracted severities now retain one entry per (CVSS version, source) pair across CVSS_V4 and CVSS_V3, preferring "Primary" metrics and CVSS 3.1 over 3.0 within each (version, source) bucket.
  • Populated severity.source:
    • Metric assessments from "nvd@nist.gov" are attributed to NVD (osvschema.Severity_NVD).
    • Assessments matching cve.sourceIdentifier (the CNA identifier) are attributed to CNA (osvschema.Severity_CNA).
  • Added SourceIdentifier to VulnerabilityMetadata and lightNVDItem (LoadTargetCVEMetadata) so lightweight loaders (e.g., Debian and Alpine converters) can accurately attribute CNA scores when parsing NVD metrics.

2. CVE 5.0 Conversion (vulnfeeds/conversion/cve5, vulnfeeds/vulns)

  • Stopped flattening CNA and ADP metrics together prior to severity extraction.
  • Extracted CVSS v4 and CVSS v3 severities from containers.cna.metrics and attributed them to CNA (osvschema.Severity_CNA).

3. ADP / Third-Party Fallback

  • Because OSV's Severity.Source enum only defines NVD, CNA, and SELF (no enum value exists for ADP or arbitrary third parties), ADP and non-CNA third-party metrics (containers.adp in CVE 5.0 or non-NVD/non-CNA metrics in NVD like CISA-ADP) are retained with source omitted (osvschema.Severity_SOURCE_UNSPECIFIED) only as a fallback when neither NVD nor CNA provides a score for that CVSS version.
  • If NVD or CNA already provides a score for that CVSS version, third-party fallback metrics for that version are omitted to avoid emitting redundant unattributed scores.

4. Combined CVE 5.0 + NVD Pipeline (vulnfeeds/cmd/combine-to-osv)

  • Previously, combineTwoOSVRecords kept only the CVE 5.0 record's severity and ignored NVD severities entirely.
  • Updated to merge severities from both records via vulns.MergeSeverities, deduplicating by (Type, Source) and replacing any unattributed SOURCE_UNSPECIFIED fallback for a CVSS version if an attributed NVD or CNA assessment exists.
  • Severities are deterministically sorted: CVSS_V4 before CVSS_V3, and NVD before CNA before SELF before SOURCE_UNSPECIFIED.

…ution

Previously, CVE conversion in vulnfeeds selected only a single highest-precedence CVSS vector per record (dropping CVSS v3 whenever CVSS v4 was present, and dropping competing NVD or CNA assessments for the same CVSS version) and discarded provenance, leaving `severity[].source` unset even though the OSV schema and downstream services already support multiple severities and source attribution.

Update NVD, CVE 5.0, and combined OSV conversion to retain one severity entry per `(CVSS version, source)` pair across CVSS v4 and CVSS v3 and populate `severity[].source`:
- Attribute NVD assessments (`nvd@nist.gov`) to `NVD` and CNA assessments (`containers.cna` in CVE 5.0 or metrics matching `cve.sourceIdentifier` in NVD) to `CNA`, preferring Primary metrics and CVSS 3.1 over 3.0 within each `(version, source)` pair.
- Because the OSV `Severity.Source` enum only defines `NVD`, `CNA`, and `SELF`, include ADP and other third-party metrics with `source` omitted (`SOURCE_UNSPECIFIED`) only as a fallback when neither `NVD` nor `CNA` provides a score for that CVSS version.
- Merge severities across CVE 5.0 and NVD records in `combine-to-osv` instead of ignoring NVD severities, deduplicating by `(Type, Source)` and replacing unattributed ADP fallbacks when an attributed `NVD` or `CNA` score exists for that CVSS version.

This branch has not been deployed

No deployments
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