feat(csaf): match components against vendor CSAF advisories (#515, part C) #521

Merged
sharang merged 1 commits from feat/515-csaf-match into main 2026-10-06 16:45:55 +00:00
Owner

Part C of #515, which completes it: target components matched against the vendor CSAF advisory index (A #518 parser, B #520 index).

What

  • pipeline::csaf_match matches two kinds of component:

    • CODESYS runtime and libraries (package manager codesys, from .projectarchive): matched by normalised product name and version against the codesys provider's advisories.
    • Any component with a purl: matched against advisory products with the same purl base. The version is taken from the product's exact version, its range, or the purl's own version.

    Only CVEs and only the products listed as affected (known_/first_/last_affected) count.

  • Alerts:

    • A match raises a CveAlert with the new source csaf. If OSV or NVD already reported that CVE, the match is merged into that alert instead: one row per CVE, and the source and summary are kept.
    • The new CveAlert.advisories field (AdvisoryRef: provider, id, title, link to the advisory page as Siemens' terms require, and the vendor's remediations for the product) is filled. The link is also added to references. Fixed versions and severity are filled in where empty.
    • The SBOM entry gets a csaf VulnRef with the link, unless the CVE is already listed.
  • Where:

    • Both the code pipeline and the PLC path call it before exploitation enrichment, reading the admin-db index. A scan never fetches.
    • For PLC targets the alerts resolve through #519.
  • compliance_core::version: Vers also reads the range forms CERT@VDE's vendors write instead of proper vers: vers:generic/4.15.0.0<4.21.0.0, the bare 4.15.0.0<4.19.0.0, and <4.17.0.0. 25 of CODESYS's 36 advisories use them; a strict parser would have missed those silently.

  • Dashboard: the VEX card shows each advisory id as a link under the CVE, with the remediation on hover. The SBOM page shows the csaf source and link as it is.

Result on real data

Matching CODESYS's 36 live advisories against the nightly PLC fixture's runtime (CODESYS Control for Linux SL 3.5.16.0) gives 25 CVEs, each linked to its VDE advisory. This is an #[ignore] live test.

Not matched yet (documented)

  • Siemens MLFB order numbers are indexed, but no component carries one until TIA exports are read.
  • CISA stays off by decision.
  • Binary version resources (#495 CPE/purl candidates) exist only in finding text.
  • Observation: NVD's :codesys: marker matches any CODESYS CPE against the runtime version; CSAF gives exact products. That's left as is.

Tests

  • Unit tests:
    • a runtime below the fix gets the alert, the fixed version doesn't, and a library isn't named;
    • merge with an existing NVD alert;
    • purl match regardless of package manager;
    • the vers forms vendors actually write.
  • Agent CVE, evidence, VEX and CSAF tests, plus core lib, vex_schemas and csaf_ingest, all pass.
  • clippy -D warnings: core, agent, dashboard (web and server), MCP.

Docs: tools reference, PLC guide. Test plan check 36, marked [visible]. Stage only; no tag.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p

Part C of #515, which completes it: target components matched against the vendor CSAF advisory index (A #518 parser, B #520 index). ## What - **`pipeline::csaf_match`** matches two kinds of component: - **CODESYS runtime and libraries** (package manager `codesys`, from `.projectarchive`): matched by normalised product name and version against the `codesys` provider's advisories. - **Any component with a purl:** matched against advisory products with the same purl base. The version is taken from the product's exact version, its range, or the purl's own version. Only CVEs and only the products listed as affected (known_/first_/last_affected) count. - **Alerts:** - A match raises a `CveAlert` with the new source **`csaf`**. If OSV or NVD already reported that CVE, the match is **merged into that alert** instead: one row per CVE, and the source and summary are kept. - The new `CveAlert.advisories` field (`AdvisoryRef`: provider, id, title, link to the advisory page as Siemens' terms require, and the vendor's remediations for the product) is filled. The link is also added to `references`. Fixed versions and severity are filled in where empty. - The SBOM entry gets a `csaf` VulnRef with the link, unless the CVE is already listed. - **Where:** - Both the code pipeline and the PLC path call it before exploitation enrichment, reading the admin-db index. A scan never fetches. - For PLC targets the alerts resolve through #519. - **`compliance_core::version`:** `Vers` also reads the range forms CERT@VDE's vendors write instead of proper `vers`: `vers:generic/4.15.0.0<4.21.0.0`, the bare `4.15.0.0<4.19.0.0`, and `<4.17.0.0`. **25 of CODESYS's 36 advisories use them**; a strict parser would have missed those silently. - **Dashboard:** the VEX card shows each advisory id as a link under the CVE, with the remediation on hover. The SBOM page shows the `csaf` source and link as it is. ## Result on real data Matching CODESYS's 36 live advisories against the nightly PLC fixture's runtime (CODESYS Control for Linux SL 3.5.16.0) gives **25 CVEs**, each linked to its VDE advisory. This is an `#[ignore]` live test. ## Not matched yet (documented) - Siemens MLFB order numbers are indexed, but no component carries one until TIA exports are read. - CISA stays off by decision. - Binary version resources (#495 CPE/purl candidates) exist only in finding text. - Observation: NVD's `:codesys:` marker matches any CODESYS CPE against the runtime version; CSAF gives exact products. That's left as is. ## Tests - Unit tests: - a runtime below the fix gets the alert, the fixed version doesn't, and a library isn't named; - merge with an existing NVD alert; - purl match regardless of package manager; - the `vers` forms vendors actually write. - Agent CVE, evidence, VEX and CSAF tests, plus core lib, `vex_schemas` and `csaf_ingest`, all pass. - clippy `-D warnings`: core, agent, dashboard (web and server), MCP. Docs: tools reference, PLC guide. Test plan check 36, marked [visible]. Stage only; no tag. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang added 1 commit 2026-10-06 16:33:23 +00:00
feat(csaf): match components against vendor CSAF advisories (#515, part C)
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 12m6s
f682fad1ef
- pipeline::csaf_match: a CODESYS runtime or library (package manager
  codesys) by normalised name and version against the codesys provider's
  advisories, and any component with a purl against advisory products with
  the same purl (version, range or the purl's own version). Only CVEs;
  only affected products (known/first/last_affected).
- A match raises a CveAlert with the new source `csaf`, or, where OSV/NVD
  reported the same CVE, is merged into that alert (one row per CVE; source
  and summary kept). The alert gains `advisories` (AdvisoryRef: provider,
  id, title, link to the advisory page as Siemens' terms ask, the vendor's
  remediations for the product) and the advisory link in references;
  fixed versions and severity fill in where empty. The SBOM entry gets a
  `csaf` VulnRef with the link (unless the CVE is listed already).
- Run in both paths before the exploitation enrichment, from the
  admin-db index (AdvisoryIndex over MongoAdvisoryStore; providers and
  purls asked for). Scans never fetch.
- compliance_core::version: Vers also reads the range forms CERT@VDE's
  vendors write besides proper vers (`vers:generic/4.15.0.0<4.21.0.0`,
  `4.15.0.0<4.19.0.0`, `<4.17.0.0`); 25 of CODESYS's 36 advisories use them.
- Dashboard: the VEX card shows each advisory id as a link, the remediation
  on hover.
- Tests: runtime below/at the fix, a library not named, merge with an NVD
  alert, purl match; an #[ignore] live test matches CODESYS's 36 real
  advisories against the nightly fixture's runtime 3.5.16.0 (25 CVEs).
- Docs: tools reference, PLC guide; test plan check 36.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang merged commit 8ea3731b51 into main 2026-10-06 16:45:55 +00:00
Sign in to join this conversation.