Files
pruefwerk/docs
Sharang ParnerkarandClaude Opus 5 ea70777c89
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 6m38s
feat(security): refuse scans aimed at our own network (#256)
Scans are aimed by the customer — a git URL, a live URL, a DAST base URL, a
pentest app URL, a PLC endpoint — and nothing checked where those resolve to.
A tenant could point a scan at `pruefwerk-mongo:27017`, at
`169.254.169.254`, or at `file:///data/compliance-scanner/ssh/id_ed25519`,
and read the result back as findings. Server-side request forgery with a UI
in front of it, and on the blob path a straight local-file read.

New `compliance_core::net_guard`, dependency-free so every crate can use it:

- `check_url` / `check_git_url` — scheme and host rules. http(s) for fetches;
  git additionally allows ssh but never `file://`, `git://` or a bare path
  (including scp-style `git@host:org/repo`).
- `check_ip` — refuses loopback, private, carrier-NAT, link-local (with the
  cloud-metadata address), documentation, benchmarking and reserved ranges,
  in v4, v6 and v4-mapped-v6 form.
- `check_resolved` — resolves a name and requires *every* answer to pass, so
  a host that returns one public and one private address is refused.
- Internal names are refused by shape: single-label hosts (`mongo`,
  `compliance-agent`), `localhost`, `.internal`, `.local`, `.home.arpa`.

Wired in at each place a tenant decides where we connect: git and live-URL
ingest, DAST target creation, DAST scan start (re-resolved at use, not only at
registration), the pentest wizard's app URL, and the ICS probe, which opens
raw TCP connections.

Blob artifacts (firmware, archives, PLC projects, mobile packages) now require
an uploaded `stored_path`. `source_ref` used to be read as a filesystem path
when no upload existed, so an API caller could name any file the agent can
read and ingest it as their own artifact.

On-premise runners legitimately scan private ranges — a Werkbank runner inside
a plant network is aimed at 10.x PLCs on purpose — so `PW_ALLOW_PRIVATE_TARGETS=1`
relaxes the policy. A hardened deployment ignores it: the cloud agent shares a
network with the platform's own services.

Stacked on #254 (`feat/fail-closed-config`) for `AppEnv`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
2026-09-20 23:37:17 +02:00
..
2026-03-08 13:59:50 +00:00