From 61953e2659d0a269ee9dc6199c1f193c9323999d Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com> Date: Fri, 6 Nov 2026 22:54:11 +0100 Subject: [PATCH 1/3] docs(design): active testing, a throwaway copy first (t83) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Proposed design for the user to decide. Active tests run by default against a copy of the customer's application, built from the repository in a short-lived sandbox (the Prüfumgebung). The code graph steers them: routes from code, and static findings confirmed against the copy. Live testing is an optional add-on with written authorisation. Covers what exists today (checked against the code), which targets qualify, build failures and charging, limits, the entitlement, cost and a Testtag price, a stage test plan, and the SKU and LB wording. Nothing is enabled. Co-Authored-By: Claude Opus 5.5 --- docs/design/active-testing-in-production.md | 367 ++++++++++++++++++++ 1 file changed, 367 insertions(+) create mode 100644 docs/design/active-testing-in-production.md diff --git a/docs/design/active-testing-in-production.md b/docs/design/active-testing-in-production.md new file mode 100644 index 0000000..a8f2951 --- /dev/null +++ b/docs/design/active-testing-in-production.md @@ -0,0 +1,367 @@ +# Active testing: a throwaway copy first, the live system as an add-on + +**Status:** proposed design for the user to decide (t83) · 2026-11-06. Nothing is enabled +by this note. +**Not published:** `docs/design/` is excluded from the documentation site. + +## Summary + +Production runs with `PW_FEATURES=source_only`. That switches off DAST, the +LLM-driven pentest, the ICS probe and OpenPLC provision-and-test for the whole +deployment. The Leistungsbeschreibung (LB 1.0.2, §4 Abs. 3) excludes active tests. +Production can import results from a test someone else ran (#337, #349). + +**The proposal: active tests run against a throwaway copy by default.** + +1. **The Prüfumgebung (default).** We build the customer's application from the repository + Prüfwerk already has. It is started in a short-lived, isolated sandbox, with an + internal network only and no outbound traffic while testing. DAST and the automated + pentest run against that copy only. Then everything is thrown away. We never send + traffic to a customer's server. +2. **The code graph steers the test.** Routes taken from the code say what to test, + instead of a crawl guessing. A static finding that an entry point reaches is tried + against the copy. It is then reported as *confirmed exploitable* or *possible*. +3. **Live testing is an optional add-on**, off by default and switched on per tenant. + It is for what only the live system shows: TLS, headers, exposed ports, WAF, cloud + configuration. It needs written authorisation, our source IPs, rate limits and + complaint handling. +4. **Price per run**, in a Testtag unit like the Prüftag. A run costs a build plus a + sandbox, so it can't be unlimited. + +**Why the copy first:** + +| | Prüfumgebung (copy) | Live system | +| --- | --- | --- | +| Authorisation | The code is the customer's and already ours to process under the Prüfwerk contract; the copy runs on our hardware. No third party is touched. | Written authorisation, proof of ownership, a time window | +| Traffic from our IPs to the internet | none | yes: complaints, abuse reports, WAF blocks | +| Aggressive tests (writes, fuzzing, LLM-chosen URLs) | allowed: the copy is thrown away | restricted to non-destructive at a low rate | +| Logged-in tests | easy: the Prüfprofil brings test users | needs the customer's credentials (unused today, see L4) | +| What it can't show | the real deployment (TLS, WAF, reverse proxy, cloud, real data) | that is exactly what it shows | +| Hard part | **building it** (see [What qualifies](#what-qualifies-and-what-doesnt)) | legal and operations | + +## What exists today + +All of this was checked against `origin/main` (168cbe9). + +### Engines + +| Engine | What it does | Where | +| --- | --- | --- | +| DAST | Our own Rust code; there is no ZAP or Nuclei inside (those are import formats only). Steps: recon, a depth-limited crawler, then five agents in parallel: SQL injection, XSS, auth bypass, SSRF, API fuzzer. Targets: web app, REST API, GraphQL. | `compliance-dast` | +| Automated pentest | An LLM tool loop: at most 50 iterations, 30 min by default, at most 5 sessions at once. Tools: the DAST agents, plus TLS, headers, cookies, CSP, CORS, DNS/DMARC, a rate-limit tester, an OpenAPI parser and a Chrome browser over CDP. | `compliance-agent/src/pentest`, `compliance-dast/src/tools` | +| ICS probe | Read-only: Modbus/TCP function codes 0x03, 0x01 and 0x2B/0x0E; the OPC UA HEL/ACK handshake; EtherNet/IP ListIdentity; a TCP connect scan of nine OT ports; 5 s per probe. | `werkbank-exec/src/ics` | +| OpenPLC provision-and-test | Starts a throwaway OpenPLC container per scan, loads the ST program extracted from the customer's PLC project, and runs DAST and the ICS probe against it. | `werkbank-exec/src/plc` | + +### The sandbox base we already have + +`werkbank-exec/src/plc/provision.rs` (306 lines) is the nearest thing to a Prüfumgebung: + +- **Container hardening:** + - one container per scan, named uniquely; + - `--memory`, `--cpus` and `--pids-limit 512`; + - `--security-opt no-new-privileges` and `--stop-timeout 5`; + - no `-p`, so no port is ever published to the host. +- **Cleanup:** + - an owner label; + - a reaper that removes instances older than twice their maximum lifetime. +- **Tests:** the `docker` argument list comes from pure functions, so it is unit-tested + without Docker. +- **The DAST guard:** it runs DAST with `NetGuard::allow_private()`, but only against + that instance (`werkbank-exec/src/plc/mod.rs:253`). + +**What it does not do, and a Prüfumgebung needs:** + +| Gap | Today | Needed | +| --- | --- | --- | +| Network isolation | The container joins **the agent's own network** (`--network cfg.network`), so it can reach the agent, Mongo and the internet. | A fresh `docker network create --internal` per run, holding only the copy, its dependencies and the test tools. Nothing else is reachable, and nothing leaves. | +| Building | It runs a ready-made OpenPLC image. | Build the customer's image from their Dockerfile or Compose file (below). | +| Several containers | one | A Compose project: the app plus a database, cache and so on. | +| Readiness | A fixed Modbus/WebVisu port. | A health URL from the Prüfprofil, with a deadline. | +| Isolation strength | A plain Docker container, started through a Docker socket mount, which is root on the host. | Customer code is untrusted. A run needs a VM boundary (Kata/Firecracker or gVisor `runsc`), on a host that is **not** a platform node. | +| Gate | `PLC_RUNTIME_ENABLED` | The existing `PW_ALLOW_UNTRUSTED_CODE_EXEC` policy (`compliance-core/src/exec_policy.rs:83`) already says tenant code may run only "on a single-tenant or sandboxed deployment". The multi-tenant agent keeps it off. | + +**Where the Prüfumgebung runs.** It runs on a Breakpilot-hosted **Werkbank runner**: a +dedicated host outside the platform nodes, not inside the agent. The Werkbank contract +already has the right shape. The control plane queues a job, and a runner leases it, +provisions, runs and posts results (`handlers/werkbank_jobs.rs`). `JobType` already has +`Dast` and `Pentest` (`compliance-core/src/models/werkbank.rs:25-33`), but nothing creates +them yet; `enqueue` only builds PLC provision jobs. On production the Werkbank path is +off. + +The same runner design also serves a customer who wants the Prüfumgebung inside their own +network. That is the on-premises Werkbank direction already decided. + +### What the graph does today + +- **The pentest reads the graph.** `pentest/context.rs:93-140` loads up to 50 nodes + with `is_entry_point: true` and links SAST findings to them by file path. The prompt + gets a "Code Entry Points (Knowledge Graph)" section (`prompt_builder.rs:205-271`). +- **Reachability exists.** `compliance-graph/src/graph/impact.rs:30-70` searches + backwards from a finding to the entry points that reach it. It also builds call chains + of up to 10 hops, and forward blast radius. Triage puts this in its prompt + (`llm/triage.rs:317-344`). +- **Entry points are coarse.** + - Rust: `main`, `#[test]`, `#[tokio::main]` and every `pub` function. + - JavaScript: every exported function. + - Python: `main`, `__main__` and the decorators `app.route`, `app.get` and `app.post`. + - TypeScript: its own rule. + - There is no HTTP route model (method, path, parameters), and C and C# are not parsed + (that is t82). +- **No exploitability status.** Nothing marks a finding as confirmed exploitable. A + DAST finding and a SAST finding on the same weakness are not linked. + +### Tests + +| Area | Tests | In CI | +| --- | --- | --- | +| net_guard, guarded_net | 10 + 5 unit tests | yes | +| ICS probe, OpenPLC provisioning | 13 + 10 unit tests | yes | +| Pentest orchestrator, prompt builder | 7 + 20 unit tests | yes | +| DAST agents and tools | about 63 unit tests | **no**: `compliance-dast` is missing from CI's clippy and test steps (`ci.yml:128-164`) | +| DAST API | 2 integration tests | yes | +| A full run against a real target | none; there is no `pw-target` | no | + +## Proposed design + +### 1. The Prüfumgebung (default) + +**The Prüfprofil.** The customer describes how to start their application. It can be a +file in the repository (`.breakpilot/pruefprofil.yml`) or a form on the target page: + +- **compose:** the path of the Compose file, or a Dockerfile with a port. +- **service:** the container and port under test. +- **health:** a URL that answers 200 once the app is up. +- **seed:** an optional command that loads test data. +- **users:** test accounts with roles, which makes logged-in testing possible. +- **env:** configuration and **test secrets only**. The profile says so, and a check + refuses values that look like real keys, using the secret scanner we already run. + +**A run, in outline:** +- The control plane queues a Werkbank job with the target's code and Prüfprofil. +- A Breakpilot-hosted runner builds the copy, waits for its health URL, runs DAST or the + automated pentest against it, posts the findings back, and throws everything away. +- The detailed runner and isolation design is a follow-up, written and reviewed with + infra before any code. + +### What qualifies and what doesn't + +| Target | Prüfumgebung | Notes | +| --- | --- | --- | +| Web app or API with a working Dockerfile or Compose file and a Prüfprofil | **yes** | Phase 1. Linux containers only. | +| ASP.NET on .NET 6 or later | yes, with a Dockerfile | Routes from code need the C# parser (t82). | +| ASP.NET on .NET Framework (Windows only) | **no** | It would need Windows containers, which we don't offer. | +| PLC programs (ST, PLCopen) | yes, through the existing OpenPLC Werkbank path | Already built; off on production. | +| Firmware | only through emulation | Not in phase 1; a separate decision. | +| Desktop HMI, mobile apps | no | Static analysis only. | +| A repository with no Dockerfile or Compose file | no | We don't guess how to build it. The target page says what is missing. | + +**Building is the hard part, and the note says so plainly.** Most customer repositories +don't start cleanly from a fresh checkout. They depend on a database, configuration or +private packages. Phase 1 therefore takes only what the customer has made startable: a +working Dockerfile or Compose file plus a Prüfprofil. A free **Probelauf** lets the +customer find this out before paying (see the next section). + +### When the build fails + +| Cause | Example | Charged | +| --- | --- | --- | +| Ours | The runner fails, our time limit is hit through our own load, a toolchain we claim to support is missing | **no**; the run is retried or refunded | +| The customer's input | The Dockerfile doesn't build, the health URL never answers, the Prüfprofil is missing or wrong | **yes**, as with t72's "failures on the customer's input count" | +| Probelauf | Only build and start, then a health check, with no test | **never charged**, so the customer can fix their profile for free | + +The run's page shows which of these it was, with the build log, so the customer can fix +their side. + +### Limits per run + +- **Wall clock:** about 15 min to build and start, about 30 min to test, 60 min in total. + At the limit the run stops and keeps what it found. +- **Resources:** a fixed CPU, memory and disk budget per run (proposed: 4 CPUs, 8 GB, + 20 GB), sized together with infra. +- **Concurrency:** one run per tenant at a time, and a fixed number per runner. +- **Cleanup:** nothing survives a run: images, containers, networks and data are removed + every time, and a reaper removes leftovers. + +### 2. The graph steers the test + +| Step | Exists | New | +| --- | --- | --- | +| Entry points in the pentest prompt | yes (`pentest/context.rs`) | – | +| From a finding back to the entry points that reach it, with call chains | yes (`graph/impact.rs`, used in triage) | – | +| **HTTP routes from code** (method, path, parameters) | no; entry points are coarse | Route extractors per framework: ASP.NET attributes and minimal APIs (after the C# parser of t82), Express, Flask/FastAPI, axum. An OpenAPI file in the repository counts too. The test goes through exactly these routes instead of crawling. | +| **Confirm a static finding** | no | For a SAST finding whose entry point is a route, the matching DAST check runs against that route on the copy (SQL injection for CWE-89, XSS for CWE-79, SSRF for CWE-918 and so on). | +| **Exploitability status** on a finding | no | `confirmed exploitable` (the copy showed it), `possible` (reachable, not shown) or `not tested`. The finding list and the CRA view can sort by it. | + +The benefit: fewer false alarms in front of the customer, and a smaller LLM budget, +because the pentest starts from known routes and known suspects instead of exploring. + +### 3. Live testing (optional add-on) + +Live testing covers what a copy can't show: TLS, security headers, exposed ports, WAF +behaviour and cloud configuration. Off by default; switched on per tenant. + +**Conditions:** +- **Written authorisation:** the customer owns the target or is authorised in writing by + the owner. Draft clause below, for legal review. +- **Proof of ownership:** a DNS record or file token, checked before every run. +- **A time window** set by the customer, inside which runs may start. +- **Our source IPs**, published so customers can allowlist them, with reverse DNS and an + info page naming Breakpilot. +- **Rate limits:** low request rates, non-destructive checks only, a short time limit. +- **Complaint handling:** an abuse contact, a runbook, and kill switches globally, per + tenant, per target and per run. + +**What has to change in the code before live testing** (from the survey; none of it is +reachable on production today): + +| # | Gap | Size | +| --- | --- | --- | +| L1 | No ownership check exists. | M | +| L2 | Once enabled, every live-URL target would get DAST and the ICS probe every 6 hours (`change.rs:86`). Live tests must run only on request. | S | +| L3 | The target's rate limit is ignored (a fixed 100 ms in `dast.rs:172`); there is no page cap, no timeout and no overall deadline; DAST runs outside the scan concurrency limit. | M | +| L4 | `auth_config` is stored but unused, so live tests are unauthenticated. | M (later) | +| L5 | The pentest's browser and the URLs the LLM picks are not held to the target host. | M | +| L6 | `allow_destructive` is enforced only for DELETE. | S | +| L7 | The DAST and pentest routes check no role. | S | + +These also apply to the Prüfumgebung, except L1 and L2: +- `compliance-dast` has to join CI; +- the routes need a role check (L7); +- the caps in L3 keep a run inside its budget. + +**Draft clause** (live add-on only), for legal review: + +> Der Kunde versichert, dass er Inhaber des angegebenen Prüfobjekts ist oder vom Inhaber +> schriftlich ermächtigt wurde, aktive Sicherheitsprüfungen daran zu beauftragen. Er +> beauftragt Breakpilot, das Prüfobjekt im angegebenen Zeitfenster von den in der +> Leistungsbeschreibung genannten Quell-IP-Adressen aus automatisiert zu prüfen. Der +> Kunde sorgt für eine aktuelle Sicherung und informiert betroffene Dritte, etwa seinen +> Hosting-Anbieter. Er stellt Breakpilot von Ansprüchen Dritter frei, die auf einer +> fehlenden oder unzutreffenden Ermächtigung beruhen. + +### 4. Entitlement per tenant + +`PW_FEATURES=source_only` stays as the global kill switch. Below it, the tenant registry +decides per tenant, as in t72: + +- The entitlement check already takes an `addon` parameter that every caller passes as + `None` (`registry.rs:369`). +- The add-on names: `pruefumgebung` and `live_testing`. +- The dashboard reads features only from the global `/version` handshake. It needs a + tenant-scoped answer: add the add-ons to the usage response of t72 + (`GET /api/v1/metering/usage`). +- Usage events, counts only, never names: + - `testtag.booked`, key `testtag:{tenant}:{target}:{YYYY-MM-DD}`; + - `live_test.run`. +- Recommendation: an active run does **not** count against the t72 Prüfung quota. It is + metered on its own. + +### 5. Cost and price + +**Our cost per run** is an estimate, to be measured on stage: + +- **Compute:** + - building and starting the copy takes about 10–15 min on 4 CPUs; + - a test takes about 30 min, with the copy and the test tools together on about 4 CPUs; + - in total about 2.5–3 CPU-hours and up to 8 GB of memory per run. +- **On a dedicated runner host** (assumption, to confirm with infra: 16 cores and 64 GB + at about 100–150 € per month), that is about 4 runs at once: + - full use: well under 0.10 € of compute per run; + - 10 % use: about 0.30–0.60 € per run. +- **The automated pentest** adds LLM time on our own model: up to 50 rounds, roughly + 0.5–1 million tokens per session. That is GPU time, not money per token; measure it on + stage. +- **Fixed costs** are lower than for live testing (no complaints, no legal exposure to + third parties). They remain the runner host, support for failed builds, and the + Prüfprofil help. + +**Price suggestion**, set against the 9,99 € Prüftag and the 5,99 € extra target: + +| SKU | Contents | Suggestion | +| --- | --- | --- | +| `pruefwerk-testtag` | The Prüfumgebung for one target on one Berlin day, with up to 3 runs (DAST or automated pentest), so a customer can fix and test again the same day | 24,99 € per Testtag | +| `pruefwerk-probelauf` | Build and start only, no test | free | +| `pruefwerk-live` (add-on) | Live testing of verified targets, on request, including 5 runs per month | 29,00 € per month per tenant | +| `pruefwerk-live-run` | Each live run beyond the included 5 | 4,99 € per run | + +A Testtag mirrors the Prüftag that customers already know. It caps our cost per booking, +and it fits how fixes really go: test, fix, test again. + +## Test plan on stage + +1. **pw-target:** our own deliberately vulnerable web app with a Dockerfile and a + Prüfprofil. Ideally one in ASP.NET, which also tests the C# routes from t82, and one + in Node. +2. **A repository with Compose:** an open-source app with a database in its Compose + file, to prove that several containers build and start. +3. **Probelauf:** for both, it passes; with a broken Dockerfile it fails visibly, as the + customer's fault, and is not charged. +4. **Runs:** DAST and the automated pentest on both. The known vulnerabilities of + pw-target are the baseline; add a nightly fixture that compares against it. +5. **Graph steering:** the routes found in code match pw-target's real routes. A planted + SQL injection found by SAST comes back as `confirmed exploitable`, and an + unreachable one as `possible`. +6. **Limits and cleanup:** the run stops at its time limit; nothing is left behind after + a run; a second run of the same tenant waits. +7. **Entitlement and metering:** + - a tenant without the add-on is refused; + - a Testtag is booked once and allows 3 runs; + - the usage events carry counts only. +8. **Measure** minutes, CPU, memory and LLM tokens per run, for the price. +9. **Live add-on:** only after the user decides on it. It runs against pw-target under + a public stage name, reachable only from stage's own address, and covers the ownership + check, the time window, the rate limits and the kill switches. + +Production stays on `source_only` until the user gives the go. + +## Decisions for the user + +1. **The Prüfumgebung as the default** for active tests, with live testing as an + optional add-on. Recommended. +2. **Phase 1 scope:** web apps and APIs with a Dockerfile or Compose file plus a + Prüfprofil; PLC through the existing OpenPLC path; firmware later. +3. **Charging:** customer-side build failures count, ours never do, and the Probelauf is + free. +4. **Price:** the Testtag at 24,99 €; whether the live add-on is offered at all, and at + what price. +5. **Order:** + 1. `compliance-dast` into CI, the role check and the caps (L3, L7); + 2. the runner and isolation design with infra; + 3. the Prüfprofil; + 4. routes from code (after t82); + 5. the exploitability status; + 6. the stage test plan; + 7. the live add-on last, if wanted. + +## Needed from the registry, ERP and LB side + +**For the registry and ERP:** +- The add-ons `pruefumgebung` and `live_testing`. +- The SKUs `pruefwerk-testtag`, `pruefwerk-probelauf` (price 0, for counting), + `pruefwerk-live` and `pruefwerk-live-run`. +- The usage events `testtag.booked` and `live_test.run`, counts only. + +**LB wording** for the version that ships phase 1. It replaces the exclusion in §4 +Abs. 3 for tenants who booked the add-on: + +> **Prüfumgebung (Zusatzleistung).** Für gebuchte Mandanten baut Prüfwerk die Anwendung +> des Kunden aus dem bereitgestellten Quellcode in einer abgeschotteten, nur für diese +> Prüfung erzeugten Umgebung auf und prüft sie dort aktiv auf Schwachstellen, unter +> anderem SQL-Injection, Cross-Site-Scripting, Umgehung der Zugriffskontrolle und +> Server-Side Request Forgery. Systeme des Kunden oder Dritter werden dabei nicht +> angesprochen. Voraussetzung ist ein lauffähiges Dockerfile oder eine Compose-Datei +> sowie ein Prüfprofil mit Testdaten; produktive Daten oder Zugangsdaten dürfen nicht +> enthalten sein. Die Umgebung wird nach jeder Prüfung vollständig gelöscht. Ein +> Prüftag der Prüfumgebung („Testtag“) umfasst bis zu drei Prüfläufe eines Prüfobjekts +> an einem Kalendertag (Europe/Berlin). Ein Probelauf (nur Aufbau und Start) ist +> kostenfrei. Schlägt der Aufbau aus Gründen fehl, die Breakpilot zu vertreten hat, wird +> der Prüflauf nicht berechnet. Die Prüfung ist automatisiert und ersetzt keinen +> manuellen Penetrationstest. + +**For the live add-on** (only if decided), add: + +> **Live-Prüfung (Zusatzleistung).** Auf gesonderte Beauftragung prüft Prüfwerk ein vom +> Kunden benanntes, erreichbares System, dessen Inhaberschaft der Kunde nachgewiesen +> hat, im vereinbarten Zeitfenster von den unten genannten Quell-IP-Adressen aus mit +> nicht-destruktiven Prüfungen (u. a. TLS, Sicherheits-Header, offene Dienste). +> Steuerungen und industrielle Protokolle werden nicht aus dem Rechenzentrum geprüft. \ No newline at end of file -- 2.54.1 From deaa4e9f4e941586ab20156d768638f15b9078e3 Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com> Date: Sat, 7 Nov 2026 09:14:39 +0100 Subject: [PATCH 2/3] docs(design): t83 review: build network, Testtag billing, ERP codes, data protection - The build runs customer code and fetches packages: same VM sandbox, egress only through a package mirror, test phase internal-only. Private feeds unsupported in phase 1, or a separately stored write-only feed token used only in the build. - ERP items CRA-CSA-CLD-TST (LIV/LRN reserved); the Probelauf is only a count. - Billed per Testtag: our failures don't use one of the 3 runs, a Testtag with no successful run is not charged; booked only when the customer starts a run; a monthly cap in the portal. - Testtage in the plans as a decision. - Runner host in Germany, AVV and TOM; where logs and artifacts live and when they are deleted. - Live testing out of phase 1; the L1-L7 analysis stays. Co-Authored-By: Claude Opus 5.5 --- docs/design/active-testing-in-production.md | 236 ++++++++++++++------ 1 file changed, 173 insertions(+), 63 deletions(-) diff --git a/docs/design/active-testing-in-production.md b/docs/design/active-testing-in-production.md index a8f2951..be96761 100644 --- a/docs/design/active-testing-in-production.md +++ b/docs/design/active-testing-in-production.md @@ -1,7 +1,7 @@ -# Active testing: a throwaway copy first, the live system as an add-on +# Active testing: a throwaway copy first, the live system later -**Status:** proposed design for the user to decide (t83) · 2026-11-06. Nothing is enabled -by this note. +**Status:** proposed design for the user to decide (t83) · 2026-11-06, revised +2026-11-07 after the registry review. Nothing is enabled by this note. **Not published:** `docs/design/` is excluded from the documentation site. ## Summary @@ -14,19 +14,20 @@ Production can import results from a test someone else ran (#337, #349). **The proposal: active tests run against a throwaway copy by default.** 1. **The Prüfumgebung (default).** We build the customer's application from the repository - Prüfwerk already has. It is started in a short-lived, isolated sandbox, with an - internal network only and no outbound traffic while testing. DAST and the automated - pentest run against that copy only. Then everything is thrown away. We never send - traffic to a customer's server. + Prüfwerk already has. It is built and started in a short-lived, isolated sandbox. While + building, the only way out is a package mirror; while testing, the network is internal + only. DAST and the automated pentest run against that copy only. Then everything is + thrown away. We never send traffic to a customer's server. 2. **The code graph steers the test.** Routes taken from the code say what to test, instead of a crawl guessing. A static finding that an entry point reaches is tried against the copy. It is then reported as *confirmed exploitable* or *possible*. -3. **Live testing is an optional add-on**, off by default and switched on per tenant. - It is for what only the live system shows: TLS, headers, exposed ports, WAF, cloud - configuration. It needs written authorisation, our source IPs, rate limits and - complaint handling. -4. **Price per run**, in a Testtag unit like the Prüftag. A run costs a build plus a - sandbox, so it can't be unlimited. +3. **Live testing is not part of phase 1.** It would cover what only the live system + shows: TLS, headers, exposed ports, WAF, cloud configuration. It needs written + authorisation, our source IPs, rate limits and complaint handling, and that load is + out of proportion for now. The analysis below (L1–L7) stays so it can be decided later. +4. **Price per Testtag**, a unit like the Prüftag: up to 3 runs of one target on one day. + A run costs a build plus a sandbox, so it can't be unlimited. The customer books a + Testtag only by starting a run, and can cap them per month. **Why the copy first:** @@ -73,7 +74,7 @@ All of this was checked against `origin/main` (168cbe9). | Gap | Today | Needed | | --- | --- | --- | -| Network isolation | The container joins **the agent's own network** (`--network cfg.network`), so it can reach the agent, Mongo and the internet. | A fresh `docker network create --internal` per run, holding only the copy, its dependencies and the test tools. Nothing else is reachable, and nothing leaves. | +| Network isolation | The container joins **the agent's own network** (`--network cfg.network`), so it can reach the agent, Mongo and the internet. | Building: outbound only through a package mirror (below). Testing: a fresh `docker network create --internal` per run, holding only the copy, its dependencies and the test tools. Nothing else is reachable, and nothing leaves. | | Building | It runs a ready-made OpenPLC image. | Build the customer's image from their Dockerfile or Compose file (below). | | Several containers | one | A Compose project: the app plus a database, cache and so on. | | Readiness | A fixed Modbus/WebVisu port. | A health URL from the Prüfprofil, with a deadline. | @@ -143,6 +144,56 @@ file in the repository (`.breakpilot/pruefprofil.yml`) or a form on the target p - The detailed runner and isolation design is a follow-up, written and reviewed with infra before any code. +### The build needs the network + +Building a Dockerfile already runs customer code: every `RUN` step is a command from the +repository. It also downloads packages (npm, NuGet, pip, Maven, apt). So the build is as +untrusted as the test and gets the same protection: + +- **The same VM sandbox** as the test, on the same runner, never on a platform node. +- **Outbound traffic only through a package mirror.** The build network reaches a + pull-through proxy for the public registries (npm, NuGet, PyPI, Maven Central, Debian + and Alpine mirrors, Docker Hub through Harbor) and nothing else. No other egress: no + DNS to the outside, no Git clones from arbitrary hosts, no `curl` to the internet. A + build that needs anything else fails, and the build log says which host it tried. +- **The test phase stays internal-only.** The built images move to a fresh internal + network without the mirror; the test tools join it there. +- **Base images** come through the same Harbor proxy, so they are cached and logged. + +**Private package feeds** need real credentials, and the Prüfprofil forbids those. Two +options: + +1. **Not supported in phase 1** (recommended). A build that needs a private feed fails + as the customer's input, and the Probelauf shows it for free. The customer can vendor + the packages into the repository or publish a build image to us instead. +2. **Later: a feed token stored separately.** It is stored in the tenant's secret store, + not in the Prüfprofil; write-only from the portal, so nobody reads it back after + saving; scoped read-only to that one feed; and injected only into the build step as a + BuildKit secret, never into the image, the test phase or a log. The mirror allowlist + then gets that feed's host for this tenant only. + +### Where the data lives and when it is deleted + +The runner host is a new place where customer code is processed, so: + +- **Location:** in Germany. If it is not our own hardware, the provider goes on the AVV's + subprocessor list before the first customer run. +- **TOM:** the runner (VM isolation, egress only through the mirror, deletion after each + run, access only for the platform team) is added to the technical and organisational + measures. +- **During a run:** the checkout, images, containers, volumes and networks exist only on + the runner, on the run's own disk, and are removed at the end of the run, with a reaper + for leftovers. Nothing is pushed to a registry. +- **After a run, on the platform** (in the tenant's database, like scan results): + - the findings; + - the build log and the start log, capped in size and passed through the secret + scanner before storing. + + They are deleted with the target or the tenant, or after a retention period to be set + (proposed: logs 90 days, findings like other findings). +- **The runner keeps no customer data** after a run. Its own logs carry run ids and + counts, never code, paths or repository names. + ### What qualifies and what doesn't | Target | Prüfumgebung | Notes | @@ -163,11 +214,19 @@ customer find this out before paying (see the next section). ### When the build fails -| Cause | Example | Charged | +The Testtag is what is billed, not the run. A **successful run** is one that built, +started and finished its test (a run stopped at its time limit, with what it found, +counts as finished). + +| Cause | Example | Counts toward the 3 runs | | --- | --- | --- | -| Ours | The runner fails, our time limit is hit through our own load, a toolchain we claim to support is missing | **no**; the run is retried or refunded | +| Ours | The runner fails, our time limit is hit through our own load, a toolchain we claim to support is missing | **no**; the customer can start another run | | The customer's input | The Dockerfile doesn't build, the health URL never answers, the Prüfprofil is missing or wrong | **yes**, as with t72's "failures on the customer's input count" | -| Probelauf | Only build and start, then a health check, with no test | **never charged**, so the customer can fix their profile for free | +| Probelauf | Only build and start, then a health check, with no test | **no**, and it books no Testtag, so the customer can fix their profile for free | + +**A Testtag with no successful run is not charged**, whatever the cause. A customer whose +three runs all fail on their own Dockerfile has used up the day but pays nothing; the +Probelauf should have caught it first. The run's page shows which of these it was, with the build log, so the customer can fix their side. @@ -195,10 +254,17 @@ their side. The benefit: fewer false alarms in front of the customer, and a smaller LLM budget, because the pentest starts from known routes and known suspects instead of exploring. -### 3. Live testing (optional add-on) +### 3. Live testing (not in phase 1) Live testing covers what a copy can't show: TLS, security headers, exposed ports, WAF -behaviour and cloud configuration. Off by default; switched on per tenant. +behaviour and cloud configuration. + +**Recommendation: leave it out of phase 1 entirely** and decide later. The legal work +(authorisation clause, ownership proof), the complaint handling and the operations +(published IPs, abuse contact, kill switches) are a fixed load that a small add-on +price doesn't carry: the earlier suggestion of 29 € a month with 5 runs is too low for it. +The analysis stays here so the decision can be made on it later. If it comes, it is off +by default and switched on per tenant. **Conditions:** - **Written authorisation:** the customer owns the target or is authorised in writing by @@ -246,15 +312,26 @@ decides per tenant, as in t72: - The entitlement check already takes an `addon` parameter that every caller passes as `None` (`registry.rs:369`). -- The add-on names: `pruefumgebung` and `live_testing`. +- The add-on name: `pruefumgebung` (and `live_testing`, only if that is decided later). - The dashboard reads features only from the global `/version` handshake. It needs a tenant-scoped answer: add the add-ons to the usage response of t72 (`GET /api/v1/metering/usage`). +- **Booking:** a Testtag is booked only when the customer starts a run by hand, on the + first run of that target on that day. Never automatically, never from a schedule or + a scan, and a Probelauf never books one. +- **A monthly cap set by the customer** in the portal, like `prueftag_cap`: at most N + Testtage per calendar month, none by default. At the cap, starting a run that would + book a new Testtag is refused with a message; runs on a Testtag already booked that day + still work. - Usage events, counts only, never names: - - `testtag.booked`, key `testtag:{tenant}:{target}:{YYYY-MM-DD}`; - - `live_test.run`. + - `testtag.booked`, key `testtag:{tenant}:{target}:{YYYY-MM-DD}`, with the number of + successful runs at the end of the day (0 means not charged); + - `probelauf.run`, a count only, with no ERP item. - Recommendation: an active run does **not** count against the t72 Prüfung quota. It is metered on its own. +- **Testtage in the plans** (a decision for the user). Suggestion: none included in + Standard and Business in phase 1, until we have measured the cost per run on stage; + Enterprise by arrangement. A later option is N per month in Business (for example 2). ### 5. Cost and price @@ -277,12 +354,20 @@ decides per tenant, as in t72: **Price suggestion**, set against the 9,99 € Prüftag and the 5,99 € extra target: -| SKU | Contents | Suggestion | +ERP item codes follow the ERP scheme: + +| Item | Contents | Suggestion | | --- | --- | --- | -| `pruefwerk-testtag` | The Prüfumgebung for one target on one Berlin day, with up to 3 runs (DAST or automated pentest), so a customer can fix and test again the same day | 24,99 € per Testtag | -| `pruefwerk-probelauf` | Build and start only, no test | free | -| `pruefwerk-live` (add-on) | Live testing of verified targets, on request, including 5 runs per month | 29,00 € per month per tenant | -| `pruefwerk-live-run` | Each live run beyond the included 5 | 4,99 € per run | +| `CRA-CSA-CLD-TST` (Testtag) | The Prüfumgebung for one target on one Berlin day, with up to 3 runs (DAST or automated pentest), so a customer can fix and test again the same day; charged only with at least one successful run | 24,99 € per Testtag | +| Probelauf | Build and start only, no test | free; no ERP item, counted by `probelauf.run` | + +Only if live testing is decided later (codes reserved, prices to be set then; the earlier +29 € a month with 5 runs is too low for the fixed load): + +| Item | Contents | +| --- | --- | +| `CRA-CSA-CLD-LIV` | Live add-on, monthly, per tenant | +| `CRA-CSA-CLD-LRN` | An extra live run beyond those included | A Testtag mirrors the Prüftag that customers already know. It caps our cost per booking, and it fits how fixes really go: test, fix, test again. @@ -305,63 +390,88 @@ and it fits how fixes really go: test, fix, test again. a run; a second run of the same tenant waits. 7. **Entitlement and metering:** - a tenant without the add-on is refused; - - a Testtag is booked once and allows 3 runs; + - a Testtag is booked once, by the first run started by hand, and allows 3 runs; + - a run that fails on our side doesn't use one of the 3; a Testtag with no + successful run is reported with 0 and not charged; + - at the monthly cap, a run that would book a new Testtag is refused; - the usage events carry counts only. 8. **Measure** minutes, CPU, memory and LLM tokens per run, for the price. -9. **Live add-on:** only after the user decides on it. It runs against pw-target under - a public stage name, reachable only from stage's own address, and covers the ownership - check, the time window, the rate limits and the kill switches. +9. **Build network:** a build that fetches from the package mirror passes; one that + tries any other host fails, and its log names the host. +10. **Live add-on:** not in phase 1; only after the user decides on it. It would run + against pw-target under a public stage name, reachable only from stage's own + address, and cover the ownership check, the time window, the rate limits and the + kill switches. Production stays on `source_only` until the user gives the go. ## Decisions for the user -1. **The Prüfumgebung as the default** for active tests, with live testing as an - optional add-on. Recommended. -2. **Phase 1 scope:** web apps and APIs with a Dockerfile or Compose file plus a +1. **The Prüfumgebung as the default** for active tests. Recommended. +2. **Live testing out of phase 1** entirely, to be decided later on the L1–L7 analysis. + Recommended. +3. **Phase 1 scope:** web apps and APIs with a Dockerfile or Compose file plus a Prüfprofil; PLC through the existing OpenPLC path; firmware later. -3. **Charging:** customer-side build failures count, ours never do, and the Probelauf is - free. -4. **Price:** the Testtag at 24,99 €; whether the live add-on is offered at all, and at - what price. -5. **Order:** - 1. `compliance-dast` into CI, the role check and the caps (L3, L7); - 2. the runner and isolation design with infra; - 3. the Prüfprofil; - 4. routes from code (after t82); - 5. the exploitability status; - 6. the stage test plan; - 7. the live add-on last, if wanted. +4. **Private package feeds:** not supported in phase 1 (recommended), or a separately + stored, write-only feed token used only during the build. +5. **Charging:** billed per Testtag; failures on our side don't use one of the 3 runs, + failures on the customer's input do; a Testtag with no successful run is not charged; + the Probelauf is free and books nothing. +6. **Price:** the Testtag (`CRA-CSA-CLD-TST`) at 24,99 €. +7. **Testtage in the plans:** none in Standard and Business in phase 1, Enterprise by + arrangement (suggestion); or N per month in Business. +8. **Retention:** build and start logs 90 days (proposed), findings like other findings. +9. **The runner host:** in Germany; own hardware or a provider that goes on the AVV's + subprocessor list. With infra. +10. **Order:** + 1. `compliance-dast` into CI, the role check and the caps (L3, L7); + 2. the runner, build-network and isolation design with infra, plus the AVV and TOM + entries; + 3. the Prüfprofil; + 4. routes from code (after t82); + 5. the exploitability status; + 6. the stage test plan. ## Needed from the registry, ERP and LB side **For the registry and ERP:** -- The add-ons `pruefumgebung` and `live_testing`. -- The SKUs `pruefwerk-testtag`, `pruefwerk-probelauf` (price 0, for counting), - `pruefwerk-live` and `pruefwerk-live-run`. -- The usage events `testtag.booked` and `live_test.run`, counts only. +- The add-on `pruefumgebung` (`live_testing` only if decided later). +- The ERP item `CRA-CSA-CLD-TST` (Testtag). `CRA-CSA-CLD-LIV` and `CRA-CSA-CLD-LRN` are + reserved for a later live add-on. The Probelauf has no ERP item. +- A customer-set monthly Testtag cap in the portal, like `prueftag_cap`, none by default. +- The usage events `testtag.booked` (with the number of successful runs) and + `probelauf.run`, counts only. + +**For the AVV and TOM:** the runner host as a place of processing (Germany), and its +provider as a subprocessor if it is not our own hardware. **LB wording** for the version that ships phase 1. It replaces the exclusion in §4 Abs. 3 for tenants who booked the add-on: > **Prüfumgebung (Zusatzleistung).** Für gebuchte Mandanten baut Prüfwerk die Anwendung > des Kunden aus dem bereitgestellten Quellcode in einer abgeschotteten, nur für diese -> Prüfung erzeugten Umgebung auf und prüft sie dort aktiv auf Schwachstellen, unter -> anderem SQL-Injection, Cross-Site-Scripting, Umgehung der Zugriffskontrolle und -> Server-Side Request Forgery. Systeme des Kunden oder Dritter werden dabei nicht -> angesprochen. Voraussetzung ist ein lauffähiges Dockerfile oder eine Compose-Datei -> sowie ein Prüfprofil mit Testdaten; produktive Daten oder Zugangsdaten dürfen nicht -> enthalten sein. Die Umgebung wird nach jeder Prüfung vollständig gelöscht. Ein -> Prüftag der Prüfumgebung („Testtag“) umfasst bis zu drei Prüfläufe eines Prüfobjekts -> an einem Kalendertag (Europe/Berlin). Ein Probelauf (nur Aufbau und Start) ist -> kostenfrei. Schlägt der Aufbau aus Gründen fehl, die Breakpilot zu vertreten hat, wird -> der Prüflauf nicht berechnet. Die Prüfung ist automatisiert und ersetzt keinen -> manuellen Penetrationstest. +> Prüfung erzeugten Umgebung in Deutschland auf und prüft sie dort aktiv auf +> Schwachstellen, unter anderem SQL-Injection, Cross-Site-Scripting, Umgehung der +> Zugriffskontrolle und Server-Side Request Forgery. Systeme des Kunden oder Dritter +> werden dabei nicht angesprochen; beim Aufbau werden Pakete ausschließlich über einen +> Paket-Spiegel aus öffentlichen Quellen bezogen. Voraussetzung ist ein lauffähiges +> Dockerfile oder eine Compose-Datei sowie ein Prüfprofil mit Testdaten; produktive +> Daten oder Zugangsdaten dürfen nicht enthalten sein. Die Umgebung wird nach jeder +> Prüfung vollständig gelöscht. +> +> Abgerechnet wird je **Testtag**. Ein Testtag umfasst bis zu drei Prüfläufe eines +> Prüfobjekts an einem Kalendertag (Europe/Berlin) und wird nur gebucht, wenn der Kunde +> einen Prüflauf startet, nie automatisch. Ein Prüflauf, der aus Gründen fehlschlägt, +> die Breakpilot zu vertreten hat, wird nicht auf die drei Prüfläufe angerechnet. Ein +> Testtag ohne erfolgreichen Prüflauf wird nicht berechnet. Der Kunde kann im Portal +> eine monatliche Höchstzahl an Testtagen festlegen. Ein Probelauf (nur Aufbau und +> Start) ist kostenfrei. Die Prüfung ist automatisiert und ersetzt keinen manuellen +> Penetrationstest. -**For the live add-on** (only if decided), add: +**For a later live add-on** (only if decided), a starting point: > **Live-Prüfung (Zusatzleistung).** Auf gesonderte Beauftragung prüft Prüfwerk ein vom > Kunden benanntes, erreichbares System, dessen Inhaberschaft der Kunde nachgewiesen > hat, im vereinbarten Zeitfenster von den unten genannten Quell-IP-Adressen aus mit > nicht-destruktiven Prüfungen (u. a. TLS, Sicherheits-Header, offene Dienste). -> Steuerungen und industrielle Protokolle werden nicht aus dem Rechenzentrum geprüft. \ No newline at end of file +> Steuerungen und industrielle Protokolle werden nicht aus dem Rechenzentrum geprüft. -- 2.54.1 From 2e45dcab5c1b4c119bdcc20d1899209d0d5d82e1 Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com> Date: Sat, 7 Nov 2026 10:55:16 +0100 Subject: [PATCH 3/3] docs(design): t83 Testtag charged unless all its runs failed through our fault The user's decision (2026-11-07): a run that fails on the customer's input counts and makes the Testtag chargeable; only a Testtag whose runs all failed through Breakpilot's fault is free. The charging table, the usage event, the test plan, the decisions and the LB wording say so. Co-Authored-By: Claude Opus 5.5 --- docs/design/active-testing-in-production.md | 35 +++++++++++---------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/docs/design/active-testing-in-production.md b/docs/design/active-testing-in-production.md index be96761..a0ca1a7 100644 --- a/docs/design/active-testing-in-production.md +++ b/docs/design/active-testing-in-production.md @@ -214,9 +214,9 @@ customer find this out before paying (see the next section). ### When the build fails -The Testtag is what is billed, not the run. A **successful run** is one that built, -started and finished its test (a run stopped at its time limit, with what it found, -counts as finished). +The Testtag is what is billed, not the run. A run **counts** unless it failed through our +fault: a finished run (also one stopped at its time limit, with what it found) and a run +that failed on the customer's input both count. | Cause | Example | Counts toward the 3 runs | | --- | --- | --- | @@ -224,9 +224,9 @@ counts as finished). | The customer's input | The Dockerfile doesn't build, the health URL never answers, the Prüfprofil is missing or wrong | **yes**, as with t72's "failures on the customer's input count" | | Probelauf | Only build and start, then a health check, with no test | **no**, and it books no Testtag, so the customer can fix their profile for free | -**A Testtag with no successful run is not charged**, whatever the cause. A customer whose -three runs all fail on their own Dockerfile has used up the day but pays nothing; the -Probelauf should have caught it first. +**A Testtag is charged unless all of its runs failed through our fault** (the user's +decision, 2026-11-07). A run that fails on the customer's input counts and makes the +Testtag chargeable; the free Probelauf is how a customer checks their build first. The run's page shows which of these it was, with the build log, so the customer can fix their side. @@ -325,7 +325,8 @@ decides per tenant, as in t72: still work. - Usage events, counts only, never names: - `testtag.booked`, key `testtag:{tenant}:{target}:{YYYY-MM-DD}`, with the number of - successful runs at the end of the day (0 means not charged); + runs that count at the end of the day (0, when every run failed through our fault, + means not charged); - `probelauf.run`, a count only, with no ERP item. - Recommendation: an active run does **not** count against the t72 Prüfung quota. It is metered on its own. @@ -358,7 +359,7 @@ ERP item codes follow the ERP scheme: | Item | Contents | Suggestion | | --- | --- | --- | -| `CRA-CSA-CLD-TST` (Testtag) | The Prüfumgebung for one target on one Berlin day, with up to 3 runs (DAST or automated pentest), so a customer can fix and test again the same day; charged only with at least one successful run | 24,99 € per Testtag | +| `CRA-CSA-CLD-TST` (Testtag) | The Prüfumgebung for one target on one Berlin day, with up to 3 runs (DAST or automated pentest), so a customer can fix and test again the same day; not charged when all of its runs failed through our fault | 24,99 € per Testtag | | Probelauf | Build and start only, no test | free; no ERP item, counted by `probelauf.run` | Only if live testing is decided later (codes reserved, prices to be set then; the earlier @@ -380,7 +381,7 @@ and it fits how fixes really go: test, fix, test again. 2. **A repository with Compose:** an open-source app with a database in its Compose file, to prove that several containers build and start. 3. **Probelauf:** for both, it passes; with a broken Dockerfile it fails visibly, as the - customer's fault, and is not charged. + customer's fault, books no Testtag and is not charged. 4. **Runs:** DAST and the automated pentest on both. The known vulnerabilities of pw-target are the baseline; add a nightly fixture that compares against it. 5. **Graph steering:** the routes found in code match pw-target's real routes. A planted @@ -391,8 +392,9 @@ and it fits how fixes really go: test, fix, test again. 7. **Entitlement and metering:** - a tenant without the add-on is refused; - a Testtag is booked once, by the first run started by hand, and allows 3 runs; - - a run that fails on our side doesn't use one of the 3; a Testtag with no - successful run is reported with 0 and not charged; + - a run that fails on our side doesn't use one of the 3; a Testtag whose runs all + failed on our side is reported with 0 and not charged; + - a run that fails on a broken Dockerfile counts, and its Testtag is charged; - at the monthly cap, a run that would book a new Testtag is refused; - the usage events carry counts only. 8. **Measure** minutes, CPU, memory and LLM tokens per run, for the price. @@ -414,9 +416,9 @@ Production stays on `source_only` until the user gives the go. Prüfprofil; PLC through the existing OpenPLC path; firmware later. 4. **Private package feeds:** not supported in phase 1 (recommended), or a separately stored, write-only feed token used only during the build. -5. **Charging:** billed per Testtag; failures on our side don't use one of the 3 runs, - failures on the customer's input do; a Testtag with no successful run is not charged; - the Probelauf is free and books nothing. +5. **Charging** (decided 2026-11-07): billed per Testtag; failures on our side don't use + one of the 3 runs, failures on the customer's input do; a Testtag is charged unless + all of its runs failed through our fault; the Probelauf is free and books nothing. 6. **Price:** the Testtag (`CRA-CSA-CLD-TST`) at 24,99 €. 7. **Testtage in the plans:** none in Standard and Business in phase 1, Enterprise by arrangement (suggestion); or N per month in Business. @@ -439,7 +441,7 @@ Production stays on `source_only` until the user gives the go. - The ERP item `CRA-CSA-CLD-TST` (Testtag). `CRA-CSA-CLD-LIV` and `CRA-CSA-CLD-LRN` are reserved for a later live add-on. The Probelauf has no ERP item. - A customer-set monthly Testtag cap in the portal, like `prueftag_cap`, none by default. -- The usage events `testtag.booked` (with the number of successful runs) and +- The usage events `testtag.booked` (with the number of runs that count) and `probelauf.run`, counts only. **For the AVV and TOM:** the runner host as a place of processing (Germany), and its @@ -463,7 +465,8 @@ Abs. 3 for tenants who booked the add-on: > Prüfobjekts an einem Kalendertag (Europe/Berlin) und wird nur gebucht, wenn der Kunde > einen Prüflauf startet, nie automatisch. Ein Prüflauf, der aus Gründen fehlschlägt, > die Breakpilot zu vertreten hat, wird nicht auf die drei Prüfläufe angerechnet. Ein -> Testtag ohne erfolgreichen Prüflauf wird nicht berechnet. Der Kunde kann im Portal +> Testtag wird nicht berechnet, wenn alle seine Prüfläufe aus Gründen fehlschlagen, die +> Breakpilot zu vertreten hat. Der Kunde kann im Portal > eine monatliche Höchstzahl an Testtagen festlegen. Ein Probelauf (nur Aufbau und > Start) ist kostenfrei. Die Prüfung ist automatisiert und ersetzt keinen manuellen > Penetrationstest. -- 2.54.1