feat(cve): the daily monitor re-checks NVD/CPE-only components incrementally
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 10m4s

The CVE monitor asked only OSV, so Yocto recipes, header-detected embedded
libraries and the CODESYS runtime were re-matched in NVD only by a scan.
A new NVD pass (pipeline/nvd_monitor.rs) reads NVD's lastMod listing
(lastModStartDate/lastModEndDate, windows of at most 120 days, 500 CVEs per
page, one listing for all tenants) and matches the changed CVEs locally with
the scan's rules (virtualMatchString semantics, marker, version range).

- Cursor in the admin DB (done_until + open window/startIndex/total): a run
  stopped by its 10-minute budget, an NVD or a database error continues
  there; a listing that shrinks while paged is re-read from earlier.
- Paced with nvd_cpe::request_interval (0.6 s with NVD_API_KEY, 6 s
  without), reusing the nvd_cpe client (fetch with retries, factored out).
- Matches become the scan's CveAlert (purl, cvss, repo_id), stored with
  $setOnInsert on (cve_id, repo_id) (vex_lifecycle::store_monitored, now
  shared with the OSV pass), VEX attached, notify_new_cves, and CVE issues
  for new alerts via the shared CveIssueSync (incomplete: closes nothing).
- One INFO line per tenant with counts; NVD_MONITOR=off turns it off
  (default on).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
This commit is contained in:
Sharang ParnerkarandClaude Opus 5.5 committed 2026-10-09 19:44:30 +02:00
1 parent 42b25719ec
commit 3e17163a6e
12 files changed
+1665 -117

No files matched your search

+21 -2
View File
@@ -96,8 +96,27 @@ compared with the version in use. OSV publishes no advisories for CocoaPods, so
pods are not matched. Components that could not be matched are listed on the
scan run under **CVE-Abgleich unvollständig**.
Known components are re-checked daily, so a CVE published against an unchanged
component still raises an alert.
Known components are re-checked between scans (the CVE monitor, hourly by
default, `CVE_MONITOR_SCHEDULE`), so a CVE published against an unchanged
component still raises an alert:
- **Components with a package identifier** are asked of OSV again.
- **Components only NVD knows** (Yocto recipes by their CPE, the libraries
found by their headers, the CODESYS runtime) are re-checked incrementally:
NVD is asked which CVEs it published or changed since the last run, and
those are matched against the components with the scan's rules (product,
version range). A few requests a day cover every tenant. The requests are
paced to NVD's rate limit (with the deployment's NVD API key 50 per 30
seconds, without 5), and a run asks for at most 10 minutes; what it did not
reach, the next run reads, so no change is skipped. The first run reads the
last 7 days. `NVD_MONITOR=off` turns this part off (on by default).
A match raises the same CVE alert as a scan's, at most one per CVE and
target. A vulnerability that is "Not affected" or "Fixed" (see
[Assessing vulnerabilities](./vex-en.md)) raises no notification, and a
critical or high one of a managed repository gets its tracker issue as after
a scan. The monitor only adds: alerts no longer found are resolved by the next
complete scan.
## Packages Tab
+5 -2
View File
@@ -139,8 +139,11 @@ without a release version, a failed lookup, and recipes the scan's NVD time
budget (10 minutes) did not reach are listed under **CVE-Abgleich
unvollständig**. The requests are paced to NVD's rate limit: 50 per 30 seconds
with the deployment's NVD API key, 5 without; an answer from the last 6 hours
is reused, so the next scan gets further. The daily CVE re-check covers OSV
only and does not yet re-match recipes in NVD; a scan does.
is reused, so the next scan gets further. Between scans the CVE monitor
re-checks the recipes too (see
[Known vulnerabilities](/guide/sbom#known-vulnerabilities)): a CVE NVD
publishes or changes for a recipe's product raises an alert without a new
scan.
**What the recipe says about a CVE becomes its VEX statement**, made by the
scan, with the recipe (or patch) and its text as the impact statement, so it is
+2 -2
View File
@@ -199,7 +199,7 @@ to the SBOM with the package source `embedded` and matched against NVD by CPE.
Prüfwerk matches every SBOM component directly against two public vulnerability sources (no separate scanner binary):
- [OSV.dev](https://osv.dev/) -- batch queried by package URL (purl) for ecosystem advisories (npm, PyPI, crates.io, Go, Maven, ...)
- [NVD](https://nvd.nist.gov/) -- queried per CVE for the CVSS v3.1 base score, and by CPE for components outside a package ecosystem: the CODESYS runtime found in PLC projects and the embedded libraries above. All CVEs of the product are fetched and their affected version ranges compared with the version in use.
- [NVD](https://nvd.nist.gov/) -- queried per CVE for the CVSS v3.1 base score, and by CPE for components outside a package ecosystem: the CODESYS runtime found in PLC projects and the embedded libraries above, and the Yocto recipes. All CVEs of the product are fetched and their affected version ranges compared with the version in use. Between scans the CVE monitor asks NVD only for the CVEs changed since its last run (one time-window listing for all tenants, resumed where a run stopped) and matches them against the same components with the same rules.
Matches are stored as CVE alerts with CVSS scores and re-checked daily, so newly published CVEs against an unchanged dependency still raise a notification.
@@ -400,7 +400,7 @@ Every connection the agent opens, in one place. **Guarded** means: the HTTP clie
| Destination | What is sent | Module | Guard | Limits | Switch |
|---|---|---|---|---|---|
| `api.osv.dev` (`/v1/querybatch`, `/v1/vulns/{id}`) | purls of SBOM components, advisory ids | `pipeline/cve.rs` | guarded | 10 s per request, 5 s connect, body ≤ 16 MiB, 8 advisory reads at once | none (CVE stage) |
| `services.nvd.nist.gov` (`/rest/json/cves/2.0`) | CVE ids (CVSS score), CPE product prefixes (CODESYS, embedded libraries) | `pipeline/cve.rs`, `pipeline/nvd_cpe.rs` | guarded | 30 s per request, 5 s connect, body ≤ 16 MiB, 3 retries after 6/12/24 s, answers cached 6 h | `NVD_API_KEY` (optional, raises NVD's rate limit) |
| `services.nvd.nist.gov` (`/rest/json/cves/2.0`) | CVE ids (CVSS score), CPE product prefixes (CODESYS, embedded libraries, Yocto recipes); for the CVE monitor a time window (`lastModStartDate`/`lastModEndDate`, at most 120 days, 500 CVEs per page) | `pipeline/cve.rs`, `pipeline/nvd_cpe.rs`, `pipeline/nvd_monitor.rs` | guarded | 30 s per request, 5 s connect, body ≤ 16 MiB, 3 retries after 6/12/24 s, answers cached 6 h; the monitor paced to 0.6 s (key) / 6 s apart, 10 min per run, resumed by the next run | `NVD_API_KEY` (optional, raises NVD's rate limit); `NVD_MONITOR=off` stops the monitor's NVD pass |
| `raw.githubusercontent.com` (`/cisagov/kev-data/develop/known_exploited_vulnerabilities.json`), else `www.cisa.gov` (`/sites/default/files/feeds/known_exploited_vulnerabilities.json`) | nothing (a GET of the public KEV catalog) | `pipeline/cve_enrichment.rs` | guarded | 10 s per request, 5 s connect, body ≤ 16 MiB; at most once a day (cached for all tenants) | `CVE_EXPLOIT_LOOKUP=false` |
| `api.first.org` (`/data/v1/epss`) | CVE ids of the alerts | `pipeline/cve_enrichment.rs` | guarded | as above, 50 CVE ids per request, 500 uncached CVEs and 2 min per scan; answers cached a day per source (EPSS and Vulnrichment apart, so one that fails is asked again alone) | `CVE_EXPLOIT_LOOKUP=false` |
| `raw.githubusercontent.com` (`/cisagov/vulnrichment/develop/…`) | CVE ids of the alerts (in the path) | `pipeline/cve_enrichment.rs` | guarded | as above, 8 at once | `CVE_EXPLOIT_LOOKUP=false` |