fix(security): fix CVSS parsing and Claude prompt
CI / Test (1.22) (push) Has been cancelled
CI / Test (1.23) (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Vulnerability Check (push) Has been cancelled
CI / Format Check (push) Has been cancelled

OSV returns severity.score as a CVSS vector string, not a number, so
unmarshalling into float64 errored and every vuln was dropped. Read it
as a string, compute the CVSS v3 base score from the vector, and fall
back to the database_specific severity label otherwise.

Invoke the analysis via "claude -p" instead of a nonexistent "ask"
subcommand (which made the CLI treat "ask" as the prompt), and request
strict JSON so recommendations are parsed reliably rather than by
substring matching.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GVbEgdgcC1w6qwSq3zC4kg
This commit is contained in:
Flo
2026-06-23 15:30:05 +02:00
co-authored by Claude Opus 4.8
parent e34aa716b0
commit aac1fa7351
3 changed files with 196 additions and 34 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ func TestQueryOSVWithMockedServer(t *testing.T) {
"severity": [
{
"type": "CVSS_V3",
"score": 7.5
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
}
],
"references": [