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 5m59s
npm lockfile generation, `cargo generate-lockfile` and `cargo metadata` ran over tenant manifests with no gate, and each connects wherever the scanned repository says: a committed .npmrc or .cargo/config.toml, or a URL or git dependency in the manifest itself — outside net_guard. Forcing our own registry cannot help when the manifest names the host, so they are now gated like pip-compile, under the same opt-in, with a skip reason that says why (egress, not code execution). `cargo audit` read .cargo/audit.toml from the repository too, which could point it at another advisory database or `ignore` the repository's own advisories — silencing findings in our report. It keeps running, from a fresh empty directory with `--file <repo>/Cargo.lock`. Lockfile generation is now a pure plan plus an executor, and the npm and pip lockfile lists are shared: pip-compile no longer re-resolves a uv project and writes a second, fresh requirements.txt beside uv.lock. The js-no-lockfile nightly target now records `sbom_dependencies` as skipped instead of resolving; the scanning guide says to commit a lockfile. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
174 lines
9.2 KiB
Markdown
174 lines
9.2 KiB
Markdown
# Running Scans
|
|
|
|
Scans are the primary workflow in Prüfwerk. Each scan analyzes a repository for security vulnerabilities, dependency risks, and code structure.
|
|
|
|
## What Happens During a Scan
|
|
|
|
When a scan is triggered, Prüfwerk runs through these phases in order:
|
|
|
|
1. **Clone** -- pulls the latest code from the Git remote (or clones it for the first time)
|
|
2. **SAST** -- runs static analysis using Semgrep with rules covering OWASP, GDPR, OAuth, secrets, and general security patterns
|
|
3. **SBOM** -- extracts all dependencies using Syft, identifying packages, versions, licenses, and known vulnerabilities via OSV.dev + NVD
|
|
4. **CVE Check** -- cross-references dependencies against the NVD database for known CVEs
|
|
5. **Graph Build** -- parses the codebase to construct a code knowledge graph of functions, classes, and their relationships
|
|
6. **AI Triage** -- new findings are reviewed by an LLM that assesses severity, considers blast radius using the code graph, and generates remediation guidance
|
|
7. **Issue Sync** -- creates or updates issues in connected trackers (GitHub, GitLab, Gitea, Jira) for new findings
|
|
|
|
Each phase produces results that are visible in the dashboard as soon as they complete.
|
|
|
|
## How Scans Are Triggered
|
|
|
|
### Manual Scan
|
|
|
|
1. Go to **Repositories**
|
|
2. Click **Scan** on the repository you want to scan
|
|
3. The scan starts immediately in the background
|
|
|
|
### Scheduled Scans
|
|
|
|
Repositories are scanned automatically on a recurring schedule. By default, scans run every 6 hours and CVE monitoring runs daily. Your administrator controls these schedules.
|
|
|
|
### Webhook-Triggered Scans
|
|
|
|
When you configure a webhook in your Git hosting provider, scans are triggered automatically on push events. You can also get automated PR reviews. Webhooks are not available in this release yet; see [Webhooks & PR Reviews](/guide/webhooks).
|
|
|
|
### When scans overlap
|
|
|
|
A deployment runs a limited number of scans at once (`SCAN_CONCURRENCY`, two by
|
|
default); further scans wait for a free slot. A target is never scanned twice in
|
|
parallel: if a scan is requested while one is already running for that target,
|
|
it is queued as a single follow-up, and any further requests while that
|
|
follow-up is waiting are dropped — the follow-up will scan the latest code
|
|
anyway. Ten pushes during one long scan therefore cost two scans, and only scans
|
|
that actually run are counted towards your plan.
|
|
|
|
## Scan Phases and Statuses
|
|
|
|
Each scan progresses through these statuses:
|
|
|
|
| Status | Meaning |
|
|
|--------|---------|
|
|
| **Queued** | Scan is waiting to start |
|
|
| **Running** | Currently executing scan phases |
|
|
| **Completed** | All phases finished successfully |
|
|
| **Failed** | Stopped due to an error |
|
|
| **Interrupted** | The scanner was restarted (for example by an update) while the scan was running. Nothing in your code caused it; start the scan again. |
|
|
|
|
You can monitor scan progress on the Overview page, which shows the most recent scan runs across all repositories, including the current phase, finding count, and duration.
|
|
|
|
## Scan Types
|
|
|
|
A full scan runs multiple analysis engines, each producing different types of findings:
|
|
|
|
| Scan Type | What It Detects | Scanner |
|
|
|-----------|----------------|---------|
|
|
| **SAST** | Code-level vulnerabilities (injection, XSS, insecure crypto, etc.) | Semgrep |
|
|
| **SBOM** | Dependency inventory, outdated packages, known vulnerabilities | Syft + OSV.dev/NVD |
|
|
| **CVE** | Known CVEs in dependencies cross-referenced against NVD | NVD API |
|
|
| **GDPR** | Personal data handling issues, consent violations | Custom rules |
|
|
| **OAuth** | OAuth/OIDC misconfigurations, insecure token handling | Custom rules |
|
|
| **Secrets** | Hardcoded credentials, API keys, tokens in source code | Custom rules |
|
|
| **Code Review** | Architecture and security patterns reviewed by AI | LLM-powered |
|
|
|
|
## Where a scan may connect
|
|
|
|
Git URLs, live URLs, DAST base URLs, pentest app URLs and PLC endpoints all say
|
|
where the scanner should connect, so they decide what the agent talks to. A
|
|
cloud deployment therefore accepts **publicly routable addresses only**, and
|
|
refuses:
|
|
|
|
- loopback, private (`10/8`, `172.16/12`, `192.168/16`), carrier-NAT and
|
|
link-local addresses, including the cloud-metadata address `169.254.169.254`;
|
|
- names that only resolve inside a private network — single-label hosts such as
|
|
`mongo`, anything ending in `.internal` or `.local`, and `localhost`;
|
|
- `file://`, `git://` and bare filesystem paths as a git remote;
|
|
- blob artifacts that point at a server path instead of an uploaded file.
|
|
|
|
Hostnames are re-checked and resolved when the scan actually runs, not only when
|
|
the target is saved, and a name that resolves to both a public and a private
|
|
address is refused. For HTTP (DAST, pentest tools, issue-tracker calls) and the
|
|
PLC probe, the scanner connects to exactly the address it checked, so a name
|
|
cannot answer one address to the check and another to the connection. Every
|
|
redirect is checked the same way, at most five are followed, and a refused
|
|
redirect names the address it pointed to. Git clones and fetches are checked
|
|
right before each connection and never follow redirects.
|
|
|
|
**On-premise runners are different.** A Werkbank runner inside a plant network is
|
|
aimed at `10.x` PLCs on purpose, so it sets `PW_ALLOW_PRIVATE_TARGETS=1`. A
|
|
hardened cloud deployment ignores that variable — it shares a network with the
|
|
platform's own services.
|
|
|
|
## What the scanner runs on your code
|
|
|
|
Nearly every stage only *reads* your code: Semgrep, gitleaks, Syft, Ruff and the
|
|
PLC parser parse files and never execute them, and they connect nowhere your
|
|
repository chooses. Two kinds of stage are different. Four have to run the
|
|
project to do their job:
|
|
|
|
| Stage | What it executes |
|
|
|---|---|
|
|
| `cargo clippy` | compiles the crate, so `build.rs` and proc macros run |
|
|
| ESLint | the repository's own `node_modules/.bin/eslint`, with JavaScript config files |
|
|
| `pip-compile` | builds source distributions to read their metadata, running `setup.py` |
|
|
| Firmware reproducible build | the project's build system, through Nix |
|
|
|
|
Three more run nothing of yours, but fetch from whatever hosts your manifests
|
|
name — a registry in a committed `.npmrc`, a URL dependency in `package.json`,
|
|
a git dependency in `Cargo.toml`:
|
|
|
|
| Stage | What it fetches |
|
|
|---|---|
|
|
| `npm install --package-lock-only` | every dependency `package.json` names, to write a missing lockfile |
|
|
| `cargo generate-lockfile` | every dependency `Cargo.toml` names, to write a missing `Cargo.lock` |
|
|
| `cargo metadata` | every dependency's sources, to read its licence |
|
|
|
|
In a shared deployment all of these stages are **off**: the scanner holds many
|
|
tenants' data, and a lint warning or a generated lockfile is worth less than the
|
|
blast radius of running a stranger's build or connecting where a stranger
|
|
chooses.
|
|
|
|
**Commit your lockfile.** The SBOM is built from `package-lock.json`,
|
|
`yarn.lock`, `pnpm-lock.yaml`, `bun.lock`, `Cargo.lock`, `requirements.txt`,
|
|
`poetry.lock`, `Pipfile.lock` or `uv.lock`. A manifest without one gets no
|
|
dependency versions, and the scan run records a skipped `sbom_dependencies`
|
|
stage naming the file to commit. Bun's binary `bun.lockb` cannot be read;
|
|
commit the text `bun.lock` (`bun install --save-text-lockfile`).
|
|
|
|
`cargo audit` still runs over a committed `Cargo.lock`. It reads configuration
|
|
from the directory it runs in, so it runs from an empty one: a committed
|
|
`.cargo/audit.toml` can neither point it at another advisory database nor
|
|
silence advisories.
|
|
|
|
For a complete firmware SBOM, build with Firmwerk on your side and import the bundle.
|
|
|
|
A single-tenant or sandboxed deployment can turn them on with
|
|
`PW_ALLOW_UNTRUSTED_CODE_EXEC=1`; a hardened deployment ignores it. The stages
|
|
return later as sandboxed Werkbank jobs. The agent image does not ship Nix, so
|
|
the firmware build only runs where the agent itself runs next to a Nix
|
|
installation; everywhere else firmware SBOMs stop at analysis unless you
|
|
import a Firmwerk bundle.
|
|
|
|
Every external tool also runs with an empty environment apart from a short
|
|
allowlist (`PATH`, `HOME`, `TMPDIR`, and its own cache variables), so the
|
|
agent's credentials are not visible to it, and it is killed when its timeout
|
|
expires.
|
|
|
|
## Deduplication and Fingerprinting
|
|
|
|
Findings are deduplicated using a fingerprint hash based on the scanner, file path, line number, and vulnerability type. This means:
|
|
|
|
- **Repeated scans** will not create duplicate findings for the same issue
|
|
- **Tracker issues** are only created once per unique finding
|
|
- **Resolved findings** that reappear in a new scan are flagged for re-review
|
|
|
|
The fingerprint is also used to match findings to existing tracker issues, preventing duplicate issues from being created in GitHub, GitLab, Gitea, or Jira.
|
|
|
|
## Interpreting Results
|
|
|
|
After a scan completes, you can explore results in several ways:
|
|
|
|
- **Findings** -- browse all discovered vulnerabilities with filters for severity, type, and status. See [Understanding Findings](/guide/findings).
|
|
- **SBOM** -- review your dependency inventory, check for vulnerable packages, and audit license compliance. See [SBOM & Licenses](/guide/sbom).
|
|
- **Overview** -- check the dashboard for a high-level summary of your security posture across all repositories.
|
|
- **Issues** -- see which findings have been pushed to your issue tracker. See [Issues & Tracking](/guide/issues).
|