feat(parser): extract CVSS scores and derive severity from numeric score#18
Open
dmchaledev wants to merge 1 commit into
Open
feat(parser): extract CVSS scores and derive severity from numeric score#18dmchaledev wants to merge 1 commit into
dmchaledev wants to merge 1 commit into
Conversation
CVEEntry.cvssScore was declared in the type but never populated, and the parser ignored the numeric `score` on CycloneDX vulnerability ratings entirely. As a result a rating that carries only a score (common output from scanners such as Grype and Trivy) reported severity `undefined`, which silently slips past any severity threshold or CI gate. - Capture the highest numeric CVSS score across a vulnerability's ratings and populate CVEEntry.cvssScore. - When a rating omits a usable `severity` string, derive its qualitative severity from the score using the CVSS v3 rating scale, so score-only ratings still contribute to the most-severe selection. - Surface the score in the text and markdown reports (new CVSS column). - Add regression tests covering highest-score selection, score-derived severity, and the neither-present case. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJ7wakyvGuKdzSXpVBPkSN
This was referenced Jun 19, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
CVEEntry.cvssScore?: numberis declared insrc/types.ts(types.ts:37) but nothing ever populates it —parseCycloneDXdiscards the numericscoreon every CycloneDX rating and only reads theseveritystring (parser.ts). For a tool whose keywords aresupply-chain-security/vulnerability-management, that's two gaps:severity: undefined. CycloneDX ratings from common scanners (Grype, Trivy, cdxgen) frequently include a numericscorewith noseveritystring. Today such a CVE renders as[unknown]and would slip straight past any severity threshold / CI gate.Reproduction (before)
Fix
CVEEntry.cvssScore.severitystring, derive its qualitative severity from the score using the CVSS v3 rating scale (0none,<4low,<7medium,<9high,≥9critical), so score-only ratings still feed into the most-severe selection.[critical, CVSS 9.8]) and add a CVSS column to the markdown New CVEs table. JSON output is automatic.After:
This builds directly on the highest-severity selection merged in #16 — it extends the same single pass over
ratingsand keeps that behavior unchanged for the common severity-string case.Tests
Added three regression tests to
src/__tests__/parser.test.ts:7.5+9.8→9.8,critical)9.8→critical)undefinedVerification
npm run typecheck,npm run lint,npm run build— all cleannpm test— 32 passedPurely additive: no API changes, no change to default output beyond the added score, and behavior is identical for ratings that already carry a
severitystring.🤖 Generated with Claude Code
https://claude.ai/code/session_01WJ7wakyvGuKdzSXpVBPkSN
Generated by Claude Code