feat(demo): seed curated targets from the agent, source-only mode #251

Merged
sharang merged 2 commits from feat/demo-seed into main 2026-09-14 08:24:33 +00:00
Owner

Demonstration plan, phase D3 (agent side). Two things blocked a self-serve demo: a fresh trial tenant landed on an empty targets page, and staging tried to run DAST, pentest, the ICS probe and the soft-PLC runtime that are not deployed there, so those stages surfaced as tool errors.

Seeding

Request Meaning
GET /api/v1/targets/demo-seed what would be created: key, display name, kind, description, source_only
POST /api/v1/targets/demo-seed body {"names":[…],"rescan":false}, empty names seeds all; 202 with one row per target, status = queued | exists | failed
POST /api/v1/platform/tenants/demo/reset now takes {"seed": true} and reseeds with a service token, for the nightly sales-demo reset

Seeding runs through a new shared target lifecycle (compliance-agent/src/targets.rs: create → store upload → attach → detect), which the onboarding handlers now call as well — so a seeded target is an ordinary target with the same records and the same target.added usage events, and there is no HTTP self-call. It is idempotent by display name: the seeder owns the Demo · prefix, so a second call finds its own targets. scan_id is always null in the response because the scan run is created inside the background pipeline.

Source-only set

The manifest is now source-only: plc-pump-station, plc-conveyor-line, git-cra-vuln-demo, firmware-zephyr-example. The Juice Shop target needed a running instance for DAST and pentest and is removed, along with DEMO_WEB_URL. Everything ships inside the agent binary (manifest plus the PLC upload fixtures), so a deployed agent seeds without the repo.

PW_FEATURES=source_only

A static-analysis-only deployment: DAST, the ICS probe and the ephemeral PLC runtime record a skipped_stages entry on the scan run ({stage, status:"skipped", reason:"feature disabled"}) instead of failing; starting a DAST run or a pentest session answers 409; the flag list is published on the public /api/v1/platform/version handshake so the dashboard reads the set the agent enforces rather than its own copy of the env. Unknown flags are kept and reported, so a dashboard-only flag needs no agent release.

Docs and the ops script are updated: scripts/seed-demo-targets.sh --api hands the job to the agent, the client-side path stays for --reset and for agents older than the checkout.

Verified locally: cargo fmt --all --check, cargo clippy -p compliance-agent -- -D warnings, cargo clippy -p compliance-core -- -D warnings, cargo test -p compliance-core -p compliance-agent -p werkbank-exec -p control-map --lib (414 tests). compliance-agent/tests/demo_seed.rs needs Mongo and runs outside CI like the other integration tests.

Pairs with the dashboard's "Add demo targets" button and with orca-platform setting PW_FEATURES=source_only on the staging agent.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB

Demonstration plan, phase D3 (agent side). Two things blocked a self-serve demo: a fresh trial tenant landed on an empty targets page, and staging tried to run DAST, pentest, the ICS probe and the soft-PLC runtime that are not deployed there, so those stages surfaced as tool errors. ## Seeding | Request | Meaning | |---|---| | `GET /api/v1/targets/demo-seed` | what would be created: `key`, display `name`, `kind`, `description`, `source_only` | | `POST /api/v1/targets/demo-seed` | body `{"names":[…],"rescan":false}`, empty `names` seeds all; `202` with one row per target, `status` = `queued` \| `exists` \| `failed` | | `POST /api/v1/platform/tenants/demo/reset` | now takes `{"seed": true}` and reseeds with a service token, for the nightly sales-demo reset | Seeding runs through a new shared target lifecycle (`compliance-agent/src/targets.rs`: create → store upload → attach → detect), which the onboarding handlers now call as well — so a seeded target is an ordinary target with the same records and the same `target.added` usage events, and there is no HTTP self-call. It is idempotent by display name: the seeder owns the `Demo · ` prefix, so a second call finds its own targets. `scan_id` is always `null` in the response because the scan run is created inside the background pipeline. ## Source-only set The manifest is now source-only: `plc-pump-station`, `plc-conveyor-line`, `git-cra-vuln-demo`, `firmware-zephyr-example`. The Juice Shop target needed a running instance for DAST and pentest and is removed, along with `DEMO_WEB_URL`. Everything ships inside the agent binary (manifest plus the PLC upload fixtures), so a deployed agent seeds without the repo. ## `PW_FEATURES=source_only` A static-analysis-only deployment: DAST, the ICS probe and the ephemeral PLC runtime record a `skipped_stages` entry on the scan run (`{stage, status:"skipped", reason:"feature disabled"}`) instead of failing; starting a DAST run or a pentest session answers `409`; the flag list is published on the public `/api/v1/platform/version` handshake so the dashboard reads the set the agent enforces rather than its own copy of the env. Unknown flags are kept and reported, so a dashboard-only flag needs no agent release. Docs and the ops script are updated: `scripts/seed-demo-targets.sh --api` hands the job to the agent, the client-side path stays for `--reset` and for agents older than the checkout. Verified locally: `cargo fmt --all --check`, `cargo clippy -p compliance-agent -- -D warnings`, `cargo clippy -p compliance-core -- -D warnings`, `cargo test -p compliance-core -p compliance-agent -p werkbank-exec -p control-map --lib` (414 tests). `compliance-agent/tests/demo_seed.rs` needs Mongo and runs outside CI like the other integration tests. Pairs with the dashboard's "Add demo targets" button and with orca-platform setting `PW_FEATURES=source_only` on the staging agent. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
sharang added 1 commit 2026-09-12 19:17:02 +00:00
feat(demo): seed curated targets from the agent, source-only mode
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 5m49s
62e0b6903d
A prospect on a fresh trial saw an empty targets page and had to onboard
something by hand before Pruefwerk showed anything. The curated demo set
existed but only as a curl/jq ops script nobody outside the team runs.

The agent now seeds itself:

- GET/POST /api/v1/targets/demo-seed list and create the bundled demo
  targets for the caller's tenant, then start a scan for each. Idempotent
  by display name: an existing target reports `exists` and is left alone
  unless `rescan` is asked for. Unknown keys are a 400 before anything is
  written.
- The work runs through a new shared target lifecycle (create → upload →
  detect), which the onboarding handlers now use too, so seeded targets
  are ordinary targets: same records, same target.added usage events.
- demo/reset takes {"seed": true} and reseeds with a service token, which
  is what the nightly sales-demo reset needs.

The shipped set is source-only (two PLC projects, a CRA-vulnerable repo, a
Zephyr firmware sample); the Juice Shop target, which needed a running
instance for DAST and pentest, is gone.

PW_FEATURES=source_only makes a deployment static-analysis-only: DAST, the
ICS probe and the ephemeral PLC runtime are recorded as skipped stages
instead of failing the scan, starting a DAST run or a pentest session
answers 409, and the flags are published on the /platform/version
handshake so the dashboard reads what the agent enforces.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
sharang added 1 commit 2026-09-14 08:09:29 +00:00
Merge remote-tracking branch 'origin/main' into feat/demo-seed
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 6m35s
f888c41946
# Conflicts:
#	.env.example
sharang merged commit d9850bef90 into main 2026-09-14 08:24:33 +00:00
sharang deleted branch feat/demo-seed 2026-09-14 08:24:34 +00:00
Sign in to join this conversation.