feat(csaf): Siemens devices by order number and firmware against Siemens advisories (SPS 4a) #1077

Merged
sharang merged 1 commits from feat/siemens-order-number-match into main 2026-11-28 13:56:53 +00:00
Owner

SPS item 4a, part 1 of 2: the model, the API and the matching. The dashboard fields come in part 2, after a mockup.

Why

Siemens ProductCERT names each affected CPU by its order number (MLFB) and a firmware range, and carries no purl or CPE. Prüfwerk matched Siemens advisories by purl only, so they almost never reached a customer's component.

What

  • Model: PlcDevice { order_number, firmware, label } on a target (devices), normalised on input: order number upper case without spaces, firmware without a leading V. A device without a Siemens-shaped order number or a numeric firmware is refused with 422, because it could not be matched.
  • SBOM: each device is one entry (package manager siemens-device) with its order number, in both the code and the PLC scan paths. The PLC path's SBOM scope now covers CODESYS and devices.
  • Matching: csaf_match asks the index for the Siemens advisories naming the device's order number, and matches the product's order number plus the firmware against its range (vers:intdot/<3.1.5, vers:all/*). Fixed versions are looked up by order number. A device is matched only against Siemens advisories.
  • Export: a device is a CycloneDX device with manufacturer Siemens.
  • API: devices on POST /api/v1/targets and PATCH (the update replaces the list).
  • Docs: docs/reference/tools.md, CSAF matching.

Checked against the live Siemens feed

I read the feed only, without saving any files. The test fixture is synthetic.

  • Every product whose name carries an order number also has it in model_numbers. That held for 376 of 376 products in 40 advisories, so the stored advisories need no re-read and PARSER_VERSION stays.
  • In the 15 newest CPU advisories, 360 of 410 affected products carry an order number. The remaining 50 are family entries ("S7-1200 CPU V2 family"), which are not matched to a device yet. That needs an order-number-to-family table and is a follow-up.
  • Expected alert volume: one common CPU (6ES7511-1AK02-0AB0) is named by 5 CVEs across the 39 CPU advisories: 1 critical, 1 high, 3 medium. Two of them apply to every firmware.
  • The advisory collection has under 1,000 documents and no indexes, so the order-number query adds no index.

Not in this PR

  • The dashboard fields (part 2, mockup first).
  • PGP signature checks on the feed (separate PR, with pinned key fingerprints).
  • Family-level matching.

Tests

  • Clippy with -D warnings passes on core, agent, mcp, and the dashboard (server and web); cargo fmt is clean.
  • core 276; agent lib 1124 against a local test Mongo; agent integration: all 39 binaries pass.
  • New tests:
    • devices are matched by order number and firmware range, with the fixed version;
    • a device is never matched against another provider, and a component merely named like it is not a device;
    • one index query per order number;
    • input normalisation and refusals;
    • the CycloneDX device type.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9

SPS item 4a, part 1 of 2: the model, the API and the matching. The dashboard fields come in part 2, after a mockup. ## Why Siemens ProductCERT names each affected CPU by its order number (MLFB) and a firmware range, and carries no purl or CPE. Prüfwerk matched Siemens advisories by purl only, so they almost never reached a customer's component. ## What - **Model:** `PlcDevice { order_number, firmware, label }` on a target (`devices`), normalised on input: order number upper case without spaces, firmware without a leading `V`. A device without a Siemens-shaped order number or a numeric firmware is refused with 422, because it could not be matched. - **SBOM:** each device is one entry (package manager `siemens-device`) with its order number, in both the code and the PLC scan paths. The PLC path's SBOM scope now covers CODESYS and devices. - **Matching:** `csaf_match` asks the index for the Siemens advisories naming the device's order number, and matches the product's order number plus the firmware against its range (`vers:intdot/<3.1.5`, `vers:all/*`). Fixed versions are looked up by order number. A device is matched only against Siemens advisories. - **Export:** a device is a CycloneDX `device` with manufacturer Siemens. - **API:** `devices` on `POST /api/v1/targets` and `PATCH` (the update replaces the list). - **Docs:** `docs/reference/tools.md`, CSAF matching. ## Checked against the live Siemens feed I read the feed only, without saving any files. The test fixture is synthetic. - Every product whose name carries an order number also has it in `model_numbers`. That held for 376 of 376 products in 40 advisories, so the stored advisories need no re-read and `PARSER_VERSION` stays. - In the 15 newest CPU advisories, 360 of 410 affected products carry an order number. The remaining 50 are family entries ("S7-1200 CPU V2 family"), which are not matched to a device yet. That needs an order-number-to-family table and is a follow-up. - **Expected alert volume:** one common CPU (6ES7511-1AK02-0AB0) is named by 5 CVEs across the 39 CPU advisories: 1 critical, 1 high, 3 medium. Two of them apply to every firmware. - The advisory collection has under 1,000 documents and no indexes, so the order-number query adds no index. ## Not in this PR - The dashboard fields (part 2, mockup first). - PGP signature checks on the feed (separate PR, with pinned key fingerprints). - Family-level matching. ## Tests - Clippy with `-D warnings` passes on core, agent, mcp, and the dashboard (server and web); `cargo fmt` is clean. - core 276; agent lib 1124 against a local test Mongo; agent integration: all 39 binaries pass. - New tests: - devices are matched by order number and firmware range, with the fixed version; - a device is never matched against another provider, and a component merely named like it is not a device; - one index query per order number; - input normalisation and refusals; - the CycloneDX device type. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
sharang added 1 commit 2026-11-27 23:53:29 +00:00
feat(csaf): Siemens devices by order number and firmware against Siemens advisories (SPS 4a)
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Agent integration (pull_request) Successful in 5m7s
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 22m42s
13e848631d
A target can name the Siemens controllers it runs on (order number and
firmware). Each becomes an SBOM entry with its order number, matched
against Siemens ProductCERT advisories by the product order numbers they
already carry and the firmware range. A device matches only Siemens
advisories and exports as a CycloneDX device.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
sharang merged commit 5b4d8bbe5f into main 2026-11-28 13:56:53 +00:00
Sign in to join this conversation.