feat(csaf): index vendor CSAF advisories daily (#515, part B) #520

Merged
sharang merged 1 commits from feat/515-csaf-feed into main 2026-10-06 16:33:01 +00:00
Owner

Part B of #515: vendor CSAF advisories fetched daily into an index shared by all tenants. Part A (the parser) is merged as #518. Part C (matching and alerts) follows.

What

  • pipeline::csaf_feed
    • Providers (PW_CSAF_PROVIDERS). Unset or default reads CERT@VDE's 13 vendor providers (<vendor>.csaf-tp.certvde.com: codesys, wago, phoenixcontact, pilz, festo, helmholz, weidmueller, murrelektronik, janitza, beckhoff, lenze, turck, hilscher) plus Siemens ProductCERT. cisa adds CISA's OT feed, limited to the last two years; it's off by default, as decided, until we have a signal to match it against. off disables all; single vendors can be named.
    • Per provider:
      1. Read provider-metadata.json and take its TLP:WHITE (or CLEAR) ROLIE feeds. CISA is limited to the /OT/ feed.
      2. Take the entries that are new, or newer than the stored version.
      3. Fetch each one and check its SHA-512 against the .sha512 file the provider publishes beside it. A mismatch isn't stored; an advisory without a hash file is stored and counted as unverified. PGP signatures are not checked.
      4. Parse it with csaf_ingest and upsert it into the admin db csaf_advisories, _id = <provider>:<id>. This is public data with nothing tenant-specific.
    • Bounds: 400 advisories and 15 min per run, 4 at once, newest first, so the first Siemens fill takes a few runs. The guarded client (PublicHttp) applies; 60 s per request, 16 MiB per body.
    • Logging: one log line with counts per provider: listed, stored, unverified, hash mismatches, failed, deferred.
  • Scheduler: daily (CSAF_FEED_SCHEDULE, default 0 30 3 * * *) and once two minutes after start. Scans never fetch.
  • Docs: a CSAF section in the tools reference (providers, terms, settings) and an egress table row.

Tests

  • A fake provider covers: WHITE-only feeds (the AMBER feed is never requested), the hash check (a mismatch isn't stored and is retried next run), the delta (a stored advisory isn't fetched again, a newer feed entry is), and the per-run bound and deferral. The provider setting and the CISA OT filter have tests too.
  • An #[ignore] live test refreshes CODESYS and Siemens through the guarded client. It listed 36 and 841, stored 6 (the cap), with 0 hash mismatches.
  • clippy -D warnings.

Test plan check 35, after the PLC fix's 34. Stage only; no tag.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p

Part B of #515: vendor CSAF advisories fetched daily into an index shared by all tenants. Part A (the parser) is merged as #518. Part C (matching and alerts) follows. ## What - **`pipeline::csaf_feed`** - **Providers (`PW_CSAF_PROVIDERS`).** Unset or `default` reads CERT@VDE's 13 vendor providers (`<vendor>.csaf-tp.certvde.com`: codesys, wago, phoenixcontact, pilz, festo, helmholz, weidmueller, murrelektronik, janitza, beckhoff, lenze, turck, hilscher) plus Siemens ProductCERT. `cisa` adds CISA's OT feed, limited to the last two years; it's **off by default**, as decided, until we have a signal to match it against. `off` disables all; single vendors can be named. - **Per provider:** 1. Read `provider-metadata.json` and take its TLP:WHITE (or CLEAR) ROLIE feeds. CISA is limited to the `/OT/` feed. 2. Take the entries that are new, or newer than the stored version. 3. Fetch each one and check its **SHA-512** against the `.sha512` file the provider publishes beside it. A mismatch isn't stored; an advisory without a hash file is stored and counted as unverified. **PGP signatures are not checked.** 4. Parse it with `csaf_ingest` and upsert it into the admin db `csaf_advisories`, `_id` = `<provider>:<id>`. This is public data with nothing tenant-specific. - **Bounds:** 400 advisories and 15 min per run, 4 at once, newest first, so the first Siemens fill takes a few runs. The guarded client (`PublicHttp`) applies; 60 s per request, 16 MiB per body. - **Logging:** one log line with counts per provider: listed, stored, unverified, hash mismatches, failed, deferred. - **Scheduler:** daily (`CSAF_FEED_SCHEDULE`, default `0 30 3 * * *`) and once two minutes after start. Scans never fetch. - **Docs:** a CSAF section in the tools reference (providers, terms, settings) and an egress table row. ## Tests - A fake provider covers: WHITE-only feeds (the AMBER feed is never requested), the hash check (a mismatch isn't stored and is retried next run), the delta (a stored advisory isn't fetched again, a newer feed entry is), and the per-run bound and deferral. The provider setting and the CISA OT filter have tests too. - An `#[ignore]` live test refreshes CODESYS and Siemens through the guarded client. It listed 36 and 841, stored 6 (the cap), with 0 hash mismatches. - clippy `-D warnings`. Test plan check 35, after the PLC fix's 34. 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:23:34 +00:00
feat(csaf): index vendor CSAF advisories daily (#515, part B)
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 8m53s
bda5fc997f
- pipeline::csaf_feed: providers from PW_CSAF_PROVIDERS (default: CERT@VDE's
  13 vendor providers at <vendor>.csaf-tp.certvde.com and Siemens
  ProductCERT; `cisa` adds CISA's OT feed, last two years only; `off`).
  Per provider: metadata -> TLP:WHITE ROLIE feeds -> entries new or newer
  than stored -> fetch, SHA-512 checked against the published .sha512
  (mismatch: not stored; no hash: stored, counted unverified), read with
  csaf_ingest, stored in the admin db's csaf_advisories (shared by all
  tenants; public data). PGP signatures are not checked.
- Bounded: 400 advisories and 15 min per run, 4 at once, newest first;
  guarded client (PublicHttp), 60 s per request, 16 MiB per body.
- Scheduler: daily (CSAF_FEED_SCHEDULE, default 03:30) and once two minutes
  after start. Scans never fetch.
- Tests: fake provider (WHITE only, hash check, delta, bounds), provider
  setting; an #[ignore] live test reads CODESYS and Siemens.
- Docs: tools reference (providers, terms, settings) and egress table; test
  plan check.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang force-pushed feat/515-csaf-feed from db402f4f8e to bda5fc997f 2026-10-06 16:23:34 +00:00 Compare
sharang merged commit ff570bac66 into main 2026-10-06 16:33:01 +00:00
Sign in to join this conversation.