feat(pipeline): a DAST finding links the code finding with its CWE (#998) #1010

Merged
sharang merged 2 commits from feat/dast-sast-link into main 2026-11-16 11:46:47 +00:00
Owner

Part 4 of #998 (point 4).

Problem: point 4 asked to pass the target's open SAST findings to the DAST scan as hints. No DAST agent reads its hints (DastContext::sast_hints is only ever filled with empty lists), so that would change nothing. Agreed instead: link each DAST finding to its code finding. The pentest report and the dashboard already show DastFinding::linked_sast_finding_id (file, line, snippet), but nothing set it.

Change:

  • New pipeline::dast_findings::linked_code_finding returns the one finding of the target with the same CWE (normalised on both sides). With no CWE, or with no finding or several sharing it, there is no link: a CWE alone does not say which of several it is.
  • The DAST stage loads the target's open findings that have a place in the code and a CWE (statuses open, triaged, needs_review, scanner not dast) once per DAST target, and links each DAST finding before storing it. If they cannot be read, the DAST findings are stored unlinked (logged).
  • Docs (features/dast.md): when a DAST finding is linked.

Tests:

  • unit: the one match is linked; no CWE, another CWE, or two candidates give no link.
  • compliance-agent/tests/dast_findings.rs: with an open CWE-942 code finding seeded, the scan's CORS finding is stored linked to it. Without the linking the test fails.
  • Locally against Mongo 7: this test, the e2e DAST tests, and clippy with CI's flags.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9

Part 4 of #998 (point 4). **Problem:** point 4 asked to pass the target's open SAST findings to the DAST scan as hints. No DAST agent reads its hints (`DastContext::sast_hints` is only ever filled with empty lists), so that would change nothing. Agreed instead: link each DAST finding to its code finding. The pentest report and the dashboard already show `DastFinding::linked_sast_finding_id` (file, line, snippet), but nothing set it. **Change:** - New `pipeline::dast_findings::linked_code_finding` returns the one finding of the target with the same CWE (normalised on both sides). With no CWE, or with no finding or several sharing it, there is no link: a CWE alone does not say which of several it is. - The DAST stage loads the target's open findings that have a place in the code and a CWE (statuses `open`, `triaged`, `needs_review`, scanner not `dast`) once per DAST target, and links each DAST finding before storing it. If they cannot be read, the DAST findings are stored unlinked (logged). - Docs (`features/dast.md`): when a DAST finding is linked. **Tests:** - unit: the one match is linked; no CWE, another CWE, or two candidates give no link. - `compliance-agent/tests/dast_findings.rs`: with an open CWE-942 code finding seeded, the scan's CORS finding is stored linked to it. Without the linking the test fails. - Locally against Mongo 7: this test, the `e2e` DAST tests, and clippy with CI's flags. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
sharang added 1 commit 2026-11-16 11:19:30 +00:00
feat(pipeline): a DAST finding links the code finding with its CWE (#998)
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Agent integration (pull_request) Successful in 4m34s
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) Canceled after 4m44s
7d4004b7c3
#998 point 4 asked to pass the target's open SAST findings to the DAST
scan as hints. No DAST agent reads its hints, so that would change
nothing. `DastFinding::linked_sast_finding_id` is read by the pentest
report and the dashboard (file, line, snippet), but nothing set it.

- New `pipeline::dast_findings::linked_code_finding`: the one finding of
  the target with the same CWE. No CWE, none or several with it: no link,
  since a CWE alone does not say which of several it is.
- The DAST stage loads the target's open findings with a place in the
  code and a CWE (statuses open, triaged, needs_review) once per DAST
  target and links each DAST finding before storing it.
- Docs: when a DAST finding is linked.

Tests:
- unit: the one match is linked; no CWE, another CWE or two candidates
  give no link.
- `tests/dast_findings.rs`: with an open CWE-942 code finding seeded, the
  scan's CORS finding is stored linked to it. It fails without the link.

Part 4 of #998 (point 4, agreed as linking instead of hints).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
sharang added 1 commit 2026-11-16 11:24:14 +00:00
Merge branch 'main' into feat/dast-sast-link
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 / Agent integration (pull_request) Successful in 5m17s
CI / Check (pull_request) Successful in 21m37s
6537be5dad
sharang merged commit 98be82c0d0 into main 2026-11-16 11:46:47 +00:00
sharang deleted branch feat/dast-sast-link 2026-11-16 11:46:47 +00:00
Sign in to join this conversation.