feat(ci): nightly scan regression against the built image (#188)
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 6m31s

The nightly workflow only ran the stale e2e suite (#298). It lacked the
firmwerk git auth, so it could not even compile.

- tests/nightly.rs: seeds the demo-target corpus on a running agent
  (NIGHTLY_AGENT_URL), waits for every scan, and compares the results with:
  - the manifest's `expect` block, now `Expect::violations`, reusable;
  - blessed snapshots in fixtures/nightly/baselines/: exact for scan status,
    skipped stages, SBOM and deterministic findings; at-least for CVEs and
    semgrep registry rules.
  LLM code review is ignored. Control refs, which only the LLM control judge
  stamps, are reported as advisory (`Expect::llm_violations`). NIGHTLY_BLESS=1
  re-blesses. The report goes to target/nightly/.
- nightly.yml: mongo + the :latest agent image as services (dev mode,
  source_only, optional LLM), the harness in rust:1.94, the report as an
  artifact, and one tracking issue while the nightly stays red
  (NIGHTLY_ALERT_TOKEN). workflow_dispatch has a "bless" input.

Bugs the first runs found, fixed here:
- Scan phases control_triage / semantic_control_mapping /
  grounded_control_checks / plc_provision were missing from ScanPhase. Runs
  failed to deserialize and silently dropped out of GET /scan-runs (and the
  dashboard's scan list). update_phase now takes ScanPhase, so this cannot
  drift again.
- The PLC pump-station demo failed every scan since #256: its optional live
  endpoint fell back to modbus://plc-sim:502, and live URLs only accepted
  http(s). NetGuard::check_live_url now also allows modbus:// and opc.tcp://,
  with the same host rules; DAST only takes http(s) live URLs. Optional
  env-backed demo artifacts are skipped when their env var is unset, as the
  shell seeder already did.
- SBOM clean-up:
  - The pipeline's stale-entry delete compared the target id as an ObjectId
    against the stored hex string, so it never deleted anything, and removed
    dependencies stayed in the SBOM forever.
  - The firmware step deleted every entry, so a rescan with no new commits
    wiped the Syft entries.
  Each step now replaces only its own package managers.
- Manifest: `control_refs_any` was silently ignored (not in Expect). Zephyr's
  detected build system is "zephyr (west)".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
This commit is contained in:
Sharang ParnerkarandClaude Opus 5 committed 2026-09-21 23:05:05 +02:00
1 parent 40c7557349
commit 3efa2be1e1
14 files changed
+1023 -46

No files matched your search

+1 -1
View File
@@ -120,7 +120,7 @@
],
"expect": {
"detected_facts": {
"build_system": "zephyr"
"build_system": "zephyr (west)"
},
"scans_offered": [
"sast"
@@ -0,0 +1,23 @@
{
"scan_status": "completed",
"skipped_stages": [
"dast"
],
"sbom": [
"github:actions/checkout@v7.0.1",
"github:actions/configure-pages@v6.0.0",
"github:actions/deploy-pages@v5.0.0",
"github:actions/setup-python@v7.0.0",
"github:actions/upload-artifact@v7.0.1",
"github:actions/upload-pages-artifact@v5.0.0",
"github:zephyrproject-rtos/action-dco@v1.0.0",
"github:zephyrproject-rtos/action-zephyr-setup@v1.0.15",
"toolchain:zephyr-sdk@",
"unknown:/tmp/compliance-scanner/repos/dev/Demo___Firmware_RTOS___Zephyr_example-application/.github/workflows/build.yml@unknown",
"unknown:/tmp/compliance-scanner/repos/dev/Demo___Firmware_RTOS___Zephyr_example-application/.github/workflows/dco.yml@unknown",
"unknown:/tmp/compliance-scanner/repos/dev/Demo___Firmware_RTOS___Zephyr_example-application/.github/workflows/docs.yml@unknown"
],
"findings": [],
"cves": [],
"registry_rules": []
}
@@ -0,0 +1,18 @@
{
"scan_status": "completed",
"skipped_stages": [
"dast"
],
"sbom": [],
"findings": [
"gitleaks:stripe-access-token auth.py:2",
"semgrep:cra-ai-14-python-weak-cipher crypto.py:8"
],
"cves": [],
"registry_rules": [
"generic.secrets.security.detected-stripe-api-key.detected-stripe-api-key",
"python.lang.security.audit.insecure-transport.requests.request-with-http.request-with-http",
"python.pycryptodome.security.insecure-cipher-algorithm-des.insecure-cipher-algorithm-des",
"python.sqlalchemy.security.sqlalchemy-execute-raw-query.sqlalchemy-execute-raw-query"
]
}
@@ -0,0 +1,17 @@
{
"scan_status": "completed",
"skipped_stages": [],
"sbom": [],
"findings": [
"plc-control-logic:plc-default-password conveyor.xml:3",
"plc-control-logic:plc-hardcoded-credential conveyor.xml:3",
"plc-control-logic:plc-hardcoded-credential traffic_light.st:34",
"plc-control-logic:plc-insecure-comm conveyor.xml:9",
"plc-control-logic:plc-insecure-comm traffic_light.st:45",
"plc-control-logic:plc-insecure-protocol-port conveyor.xml:9",
"plc-control-logic:plc-insecure-protocol-port traffic_light.st:45",
"plc-control-logic:plc-safety-bypass traffic_light.st:59"
],
"cves": [],
"registry_rules": []
}
@@ -0,0 +1,25 @@
{
"scan_status": "completed",
"skipped_stages": [],
"sbom": [],
"findings": [
"plc-control-logic:plc-array-unchecked-index pump_station.st:29",
"plc-control-logic:plc-default-password pump_fbd.xml:8",
"plc-control-logic:plc-default-password pump_station.st:18",
"plc-control-logic:plc-division-by-zero pump_station.st:32",
"plc-control-logic:plc-hardcoded-credential pump_fbd.xml:8",
"plc-control-logic:plc-hardcoded-credential pump_station.st:18",
"plc-control-logic:plc-hardcoded-credential pump_station.st:19",
"plc-control-logic:plc-hardcoded-credential pump_station.st:41",
"plc-control-logic:plc-insecure-comm pump_fbd.xml:7",
"plc-control-logic:plc-insecure-comm pump_station.st:41",
"plc-control-logic:plc-insecure-protocol-port pump_fbd.xml:7",
"plc-control-logic:plc-insecure-protocol-port pump_station.st:41",
"plc-control-logic:plc-safety-bypass pump_fbd.xml:9",
"plc-control-logic:plc-safety-bypass pump_station.st:36",
"plc-control-logic:plc-safety-bypass pump_station.st:37",
"plc-control-logic:plc-unstructured-jump pump_station.st:45"
],
"cves": [],
"registry_rules": []
}