feat(findings): add pentest and DAST findings by hand or from a report (#337)
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 7m6s

A DAST run or penetration test is done by a person. Its results had no
way into Prüfwerk, so they could not sit next to the scan's findings or
go into the evidence.

- POST /api/v1/targets/{id}/findings adds one finding; the same finding
  (tool, title, location) twice is a 409.
- POST /api/v1/targets/{id}/findings/import?format=sarif|zap&kind=... reads
  a SARIF 2.1.0 or OWASP ZAP JSON report (up to 20 MB); findings already on
  the target are counted, not added again. A document that is not the named
  format is a 422.
- Both need the organisation's IT_ADMIN role (the dev tenant's user now has
  it). The finding records who added it and how to reproduce it.
- New ScanType::Pentest. A finding's CWE maps it to CRA controls through
  the control map (controls_for_cwe: any tool's binding for that CWE).
- Dashboard: a panel on each target's details with the form and the
  import; the finding detail shows the reproduction steps and who reported
  it. German and English.
- Guide: docs/guide/manual-findings.md.

Tests: SARIF and ZAP parsing, CWE and score handling, fingerprints, the
admin check, and an integration test (MongoDB) that adds, re-adds, imports
twice, and refuses a non-SARIF document and an unknown target.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
This commit is contained in:
Sharang ParnerkarandClaude Opus 5.5 committed 2026-09-23 16:38:52 +02:00
1 parent 8f7a2afe4d
commit 9e7e1b3ebb
22 files changed
+1700 -4

No files matched your search

+1
View File
@@ -26,6 +26,7 @@ export default withMermaid(defineConfig({
{ text: 'PLC / SPS (CODESYS)', link: '/guide/plc' },
{ text: 'Demo Targets', link: '/guide/demo-targets' },
{ text: 'Understanding Findings', link: '/guide/findings' },
{ text: 'Findings from Manual Tests', link: '/guide/manual-findings' },
{ text: 'SBOM & Licenses', link: '/guide/sbom' },
{ text: 'Issues & Tracking', link: '/guide/issues' },
{ text: 'Webhooks & PR Reviews', link: '/guide/webhooks' },
+62
View File
@@ -0,0 +1,62 @@
# Findings from Manual Tests
A DAST run or a penetration test is done by a person, not by the scanner. Its
results still belong on the target, next to the scan's findings: in the same
list, with the same statuses, and in the same evidence.
Two ways to add them, both on a target's details under **Targets**:
- **Add a finding**: one at a time, in a form.
- **Import a report**: a tool's report as a whole, in SARIF 2.1.0 or OWASP
ZAP's JSON report.
Only the organisation's administrators (`IT_ADMIN`) can add or import findings.
A tester working for a customer is invited into that customer's organisation
with that role.
## Add a finding
| Field | Notes |
|---|---|
| Test | Penetration test or DAST |
| Title, severity | Required |
| Location | A URL, an endpoint, a port (`tcp://192.0.2.10:23`) |
| CWE | `798` or `CWE-798`. It links the finding to the CRA requirements that weakness falls under |
| CVSS score | 0–10 |
| Tool | Optional; `manual` when empty |
| Description, evidence, steps to reproduce, recommended fix | Free text. Evidence is kept up to 4,000 characters |
The same finding (same tool, title and location) can be added only once.
## Import a report
| Format | Written by | One finding per |
|---|---|---|
| SARIF 2.1.0 | Nuclei, Burp and ZAP (via extensions), most commercial DAST tools | result |
| OWASP ZAP JSON ("Traditional JSON Report") | ZAP | alert: its first URL is the location, and the description says how many URLs it was found on |
Severity comes from the report: SARIF's `security-severity` score when present,
else the result's level; ZAP's risk code. CWEs are read from SARIF rule tags
(`external/cwe/cwe-79`) and ZAP's `cweid`.
Importing the same report again adds nothing: each finding already on the
target is counted as already present.
## API
```bash
# One finding
curl -X POST "$AGENT/api/v1/targets/$TARGET/findings" \
-H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{"kind": "pentest", "title": "Telnet open with a default password",
"severity": "critical", "cwe": "798", "location": "tcp://192.0.2.10:23",
"reproduction": "telnet 192.0.2.10, log in as root/root"}'
# A report (the body is the report itself, up to 20 MB)
curl -X POST "$AGENT/api/v1/targets/$TARGET/findings/import?format=sarif&kind=pentest" \
-H "Authorization: Bearer $TOKEN" --data-binary @nuclei.sarif
```
`format` is `sarif` or `zap`; `kind` is `pentest` or `dast`. The import answers
with `{"total": …, "imported": …, "duplicates": …}`. A document that is not
the named format is refused with 422, and a user without `IT_ADMIN` with 403.