feat(issues): critical and high CVEs as issues in managed repositories #452

Merged
sharang merged 1 commits from feat/cve-issues into main 2026-10-05 17:52:37 +00:00
Owner

User decision, relayed by the platform session: CVEs become Gitea issues, only critical and high, for managed git targets.

Behaviour

  • One issue per target, package and CVE (stored as finding_id = cve:<target>:<package>:<cve>). A second version of the same package opens no second issue.
    • Title: [CVE] okhttp@3.12.0: CVE-2021-0341. A GHSA advisory shows its CVE alias.
    • Labels: pruefwerk, cra:annex-i, severity:critical|high, and cve (new, created via ensure_labels).
    • Body: the summary; severity (plus CVSS if known); fixed in (from the advisory, by the package's purl) or "keine Version bekannt"; the OSV link; the CRA requirements cra-ai-22 and cra-ai-33 with titles from the control map; and a link to the target in Prüfwerk.
  • Closing: a complete scan (OSV and NVD without gaps) that no longer finds the CVE, because the dependency was updated or removed, closes the issue with a comment. A scan with a CVE gap closes nothing.
  • Reopening: if the CVE comes back, the issue is reopened, not opened a second time.
  • Medium and low CVEs open no issue.

Prerequisite: OSV advisory details

OSV's querybatch returns only the advisory ID, so until now every GHSA alert had no summary, no severity and no fixed version. "Critical/high only" would therefore never have matched.

  • The CVE stage now reads each advisory once (/v1/vulns/{id}, 8 at a time) to get:
    • the summary;
    • GitHub's severity;
    • the aliases (CVE ID);
    • the fixed versions of the matched package, by versionless purl, with the name as a fallback.
  • NVD is asked for CVSS only where the advisory itself gives no rating, which spares NVD's rate limit.
  • CveAlert gains aliases, fixed_versions and cve(), all with serde defaults.

Notifications and the SBOM view benefit too: severity and summary are now set for GHSA alerts.

Tests

  • End-to-end (cve_issues::tests, real Mongo plus a fake Gitea):
    1. a HIGH CVE opens exactly 1 issue, with the right title, label IDs [pruefwerk, cra:annex-i, severity:high, cve], "Fixed in: 4.9.2", cra-ai-22 and the target link; a MODERATE one opens none;
    2. the same scan again → nothing; an incomplete scan without the CVE → nothing;
    3. the dependency is updated → closed;
    4. the CVE comes back → reopened (counts are checked each time).
  • Parsing an OSV record: severity, CVE alias, and the fixed version of the right package only.
  • fmt and clippy with the CI flags on core, agent, MCP and both dashboard feature sets. Tests: agent lib 574, core 82.
  • Docs: managed-git DE/EN.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p

User decision, relayed by the platform session: **CVEs become Gitea issues, only critical and high**, for managed git targets. ## Behaviour - **One issue per target, package and CVE** (stored as `finding_id = cve:<target>:<package>:<cve>`). A second version of the same package opens no second issue. - **Title:** `[CVE] okhttp@3.12.0: CVE-2021-0341`. A GHSA advisory shows its CVE alias. - **Labels:** `pruefwerk`, `cra:annex-i`, `severity:critical|high`, and **`cve`** (new, created via `ensure_labels`). - **Body:** the summary; severity (plus CVSS if known); **fixed in** (from the advisory, by the package's purl) or "keine Version bekannt"; the OSV link; the CRA requirements `cra-ai-22` and `cra-ai-33` with titles from the control map; and a link to the target in Prüfwerk. - **Closing:** a complete scan (OSV and NVD without gaps) that no longer finds the CVE, because the dependency was updated or removed, closes the issue with a comment. **A scan with a CVE gap closes nothing.** - **Reopening:** if the CVE comes back, the issue is reopened, not opened a second time. - Medium and low CVEs open no issue. ## Prerequisite: OSV advisory details OSV's `querybatch` returns only the advisory **ID**, so until now every GHSA alert had **no summary, no severity and no fixed version**. "Critical/high only" would therefore never have matched. - The CVE stage now reads each advisory once (`/v1/vulns/{id}`, 8 at a time) to get: - the summary; - GitHub's severity; - the aliases (CVE ID); - the fixed versions of the matched package, by versionless purl, with the name as a fallback. - NVD is asked for CVSS only where the advisory itself gives no rating, which spares NVD's rate limit. - `CveAlert` gains `aliases`, `fixed_versions` and `cve()`, all with serde defaults. Notifications and the SBOM view benefit too: severity and summary are now set for GHSA alerts. ## Tests - **End-to-end** (`cve_issues::tests`, real Mongo plus a fake Gitea): 1. a HIGH CVE opens exactly 1 issue, with the right title, label IDs `[pruefwerk, cra:annex-i, severity:high, cve]`, "Fixed in: 4.9.2", `cra-ai-22` and the target link; a MODERATE one opens none; 2. the same scan again → nothing; an incomplete scan without the CVE → nothing; 3. the dependency is updated → closed; 4. the CVE comes back → reopened (counts are checked each time). - **Parsing an OSV record:** severity, CVE alias, and the fixed version of the right package only. - fmt and clippy with the CI flags on core, agent, MCP and both dashboard feature sets. Tests: agent lib 574, core 82. - Docs: managed-git DE/EN. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang added 1 commit 2026-10-05 17:41:00 +00:00
feat(issues): critical and high CVEs as issues in managed repositories
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 7m55s
f514f34056
For a target from a managed git source, every critical or high CVE in
its components becomes one Gitea issue per package and CVE:
"[CVE] okhttp@3.12.0: CVE-2021-0341", labelled pruefwerk, cra:annex-i,
severity:<x> and the new `cve`, with the summary, severity, the fixed
version where the advisory names one, the CRA requirements (cra-ai-22,
cra-ai-33) and a link to the target. Stored per target, package and CVE,
so a second version of the package opens no second issue. A complete scan
that no longer finds the CVE closes the issue with a comment; it reopens
when the CVE comes back. A scan with a CVE gap closes nothing.

So severity and the fix are known at all: OSV's batch endpoint returns
only advisory ids, so every GHSA alert had no summary, severity or fix.
The CVE stage now reads each advisory once (8 at a time) for its summary,
GitHub severity, aliases (the CVE id of a GHSA) and the fixed versions of
the matched package (by purl). NVD is asked for a CVSS score only where
the advisory rates nothing, sparing its rate limit. CveAlert gains
`aliases` and `fixed_versions` and `cve()`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang merged commit 7e3d57b648 into main 2026-10-05 17:52:37 +00:00
Sign in to join this conversation.