feat(ci): PLC fixtures for the nightly scan regression (#314) #324

Merged
sharang merged 2 commits from feat/nightly-plc-fixtures into main 2026-09-21 21:48:43 +00:00
Owner

Closes #314 (part of epic #309).

What

  • fixtures/nightly/targets.json: a nightly-only manifest in the demo schema. The demo manifest is compiled into the agent and offered to customers as "Add demo targets", so a corrupt archive doesn't belong there. The harness onboards these fixtures itself through the public API, the way a customer does:

    • create the target, upload files (multipart), detect;
    • switch on any opt-in enabled_scans;
    • scan.
  • Fixtures:

    Key What it proves Baseline
    plc-codesys-synthetic 2 KB .projectarchive with real CODESYS entry naming and an old runtime (3.5.16.0) exact 6-component SBOM; 70 CVEs via the NVD CPE match (at least)
    plc-codesys-proemion the real Proemion CSV-BlackBox archive (Apache-2.0) exact 37-component SBOM, 2 CVEs on runtime 4.17.0.0
    plc-ladder PLCopen Ladder Diagram, LD → ST translation exact: Modbus without auth, ports 502 and 21, credential literal
    plc-live-endpoint ST plus modbus://plc.example.com:502 with the opt-in ICS probe on exact: ics_probe recorded as skipped under source_only (never contacted), ST rules
    plc-corrupt-archive an archive that isn't a zip exact: plc_archive_sbom skipped stage with the reason
  • Real sample not committed (~10 MB): the workflow fetches it at pinned commit 164d8ee… with a sha256 check into NIGHTLY_CODESYS_SAMPLE. Locally its target is skipped without that variable.

  • Workflow: also passes an optional NIGHTLY_NVD_API_KEY, because NVD rate-limits unauthenticated clients and the CODESYS CVEs come from NVD.

Fixed on the way

  • A declared CODESYS archive that wasn't a readable zip completed with an empty SBOM, as if nothing were wrong (a customer uploading a broken archive saw "0 findings"). The run now records a plc_archive_sbom skipped stage with the reason (plc::sbom::check_archive, with a test).
  • DemoTarget.enabled_scans (optional) lets a fixture switch on opt-in scans such as the ICS probe.

Verification

  • cargo fmt --check and clippy -D warnings pass on all CI targets. Tests pass: core 92, agent 359, werkbank-exec 9, control-map 28.
  • Full corpus locally (4 demo targets plus 5 PLC fixtures), with the current agent built in rust:1.94-bookworm on the :latest image and source_only:
    • blessed on a fresh database;
    • compared on another fresh database: all 9 targets pass (~23 s), deterministic.
  • The demo baselines are unchanged.

Needs from you

Gitea Actions secrets. The ones set in Orca aren't visible to CI; this goes in the repo or org Actions secrets in Gitea:

  • NIGHTLY_ALERT_TOKEN
  • optional NIGHTLY_LITELLM_URL / NIGHTLY_LITELLM_API_KEY
  • recommended NIGHTLY_NVD_API_KEY

🤖 Generated with Claude Code

https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p

Closes #314 (part of epic #309). ## What - **`fixtures/nightly/targets.json`:** a nightly-only manifest in the demo schema. The demo manifest is compiled into the agent and offered to customers as "Add demo targets", so a corrupt archive doesn't belong there. The harness onboards these fixtures itself **through the public API, the way a customer does**: - create the target, upload files (multipart), detect; - switch on any opt-in `enabled_scans`; - scan. - **Fixtures:** | Key | What it proves | Baseline | |---|---|---| | `plc-codesys-synthetic` | 2 KB `.projectarchive` with real CODESYS entry naming and an **old runtime (3.5.16.0)** | exact 6-component SBOM; **70 CVEs via the NVD CPE match** (at least) | | `plc-codesys-proemion` | the **real** Proemion CSV-BlackBox archive (Apache-2.0) | exact 37-component SBOM, 2 CVEs on runtime 4.17.0.0 | | `plc-ladder` | PLCopen **Ladder Diagram**, LD → ST translation | exact: Modbus without auth, ports 502 and 21, credential literal | | `plc-live-endpoint` | ST plus `modbus://plc.example.com:502` with the opt-in ICS probe on | exact: `ics_probe` **recorded as skipped** under `source_only` (never contacted), ST rules | | `plc-corrupt-archive` | an archive that isn't a zip | exact: `plc_archive_sbom` skipped stage with the reason | - **Real sample not committed** (~10 MB): the workflow fetches it at pinned commit `164d8ee…` with a **sha256 check** into `NIGHTLY_CODESYS_SAMPLE`. Locally its target is skipped without that variable. - **Workflow:** also passes an optional `NIGHTLY_NVD_API_KEY`, because NVD rate-limits unauthenticated clients and the CODESYS CVEs come from NVD. ## Fixed on the way - **A declared CODESYS archive that wasn't a readable zip completed with an empty SBOM, as if nothing were wrong** (a customer uploading a broken archive saw "0 findings"). The run now records a `plc_archive_sbom` skipped stage with the reason (`plc::sbom::check_archive`, with a test). - `DemoTarget.enabled_scans` (optional) lets a fixture switch on opt-in scans such as the ICS probe. ## Verification - `cargo fmt --check` and clippy `-D warnings` pass on all CI targets. Tests pass: core 92, agent 359, werkbank-exec 9, control-map 28. - **Full corpus locally** (4 demo targets plus 5 PLC fixtures), with the current agent built in `rust:1.94-bookworm` on the `:latest` image and `source_only`: - blessed on a fresh database; - compared on another fresh database: **all 9 targets pass** (~23 s), deterministic. - The demo baselines are unchanged. ## Needs from you Gitea Actions secrets. The ones set in Orca aren't visible to CI; this goes in the repo or org **Actions** secrets in Gitea: - `NIGHTLY_ALERT_TOKEN` - optional `NIGHTLY_LITELLM_URL` / `NIGHTLY_LITELLM_API_KEY` - **recommended `NIGHTLY_NVD_API_KEY`** 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang added 1 commit 2026-09-21 21:31:30 +00:00
feat(ci): PLC fixtures for the nightly scan regression (#314)
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) Canceled after 5m34s
f2e6e0ecee
Adds fixtures/nightly/targets.json, a nightly-only manifest in the demo
schema. The demo manifest is compiled into the agent and offered as "Add demo
targets", so a corrupt archive does not belong there. The harness onboards
these fixtures itself through the public API (create, upload, detect, optional
`enabled_scans`, scan).

- plc-codesys-synthetic: a 2 KB .projectarchive with real CODESYS entry naming
  and an old runtime (3.5.16.0). The 6-component SBOM is exact, and the NVD CPE
  match yields 70 CVEs (at least).
- plc-codesys-proemion: the real Proemion CSV-BlackBox archive (Apache-2.0,
  37 components). Not committed (~10 MB): the workflow fetches it at a pinned
  commit and sha256 into NIGHTLY_CODESYS_SAMPLE.
- plc-ladder: a PLCopen Ladder Diagram (LD → ST translation) with planted
  Modbus-without-auth, FTP on 21 and a credential literal.
- plc-live-endpoint: ST plus a modbus:// endpoint with the opt-in ICS probe
  on. Under source_only the probe is recorded as skipped and nothing is
  contacted.
- plc-corrupt-archive: must fail cleanly.

Fixed on the way: a declared CODESYS archive that is not a readable zip used
to complete with an empty SBOM, as if nothing were wrong. The run now records a
`plc_archive_sbom` skipped stage with the reason (`plc::sbom::check_archive`).

The workflow also passes an optional NIGHTLY_NVD_API_KEY, because NVD
rate-limits unauthenticated clients.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang added 1 commit 2026-09-21 21:39:52 +00:00
fix(ci): install node before the nightly artifact upload
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 6m4s
a53d8cb422
The first CI run of the nightly passed its scan regression, but the report
upload failed: actions/upload-artifact is a Node action and the rust:1.94
job container has no node.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang merged commit d4cbdc822a into main 2026-09-21 21:48:43 +00:00
sharang deleted branch feat/nightly-plc-fixtures 2026-09-21 21:48:43 +00:00
Sign in to join this conversation.