feat(pipeline): the DAST stage waits for its scans and records a failure (#998) #1007

Merged
sharang merged 1 commits from feat/dast-stage into main 2026-11-16 10:30:45 +00:00
Owner

Part 1 of #998 (points 1 and 5).

Problem: maybe_trigger_dast started each DAST scan in a detached tokio::spawn. The scan run never waited for it, and a failed DAST scan was only a log line. A run read "completed" whether DAST ran or not.

Change:

  • The DAST stage awaits each DAST target's scan, with a 20-minute limit, and stores its run and findings as before.
  • A scan that fails, times out or cannot be stored is recorded as the dast stage with SkipCode::ToolFailed.
    • The subject is "DAST", so the dashboard's existing wording reads "DAST did not complete; what it checks counts as not assessed."
    • It fails the stage, not the run.
    • The error goes to the log only, like the other stages; the DAST run keeps the scanner's reason.
  • The DAST scan drops its "Exploitation" phase, which was recorded as completed without doing anything. The enum variant stays for stored runs.
  • Docs (features/dast.md): what a target's scan does with DAST.

Tests:

  • New integration::api::dast::a_dast_scan_that_does_not_complete_is_a_failed_stage_of_the_run: a target whose live URL does not resolve finishes its scan as completed, with one failed dast stage and a stored, failed DAST run.
  • On main's graph_build.rs the same test fails, because the run has no dast entry.
  • Locally against Mongo 7: the DAST integration tests, cargo test -p compliance-dast, and clippy for agent, core and dast with CI's flags.

Note: a scan run now takes as long as its DAST scans, up to 20 minutes per DAST target.

Next parts of #998: DAST findings in the main findings (point 2), the deterministic checks in every scan (point 3), SAST hints (point 4).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9

Part 1 of #998 (points 1 and 5). **Problem:** `maybe_trigger_dast` started each DAST scan in a detached `tokio::spawn`. The scan run never waited for it, and a failed DAST scan was only a log line. A run read "completed" whether DAST ran or not. **Change:** - The DAST stage awaits each DAST target's scan, with a 20-minute limit, and stores its run and findings as before. - A scan that fails, times out or cannot be stored is recorded as the `dast` stage with `SkipCode::ToolFailed`. - The subject is "DAST", so the dashboard's existing wording reads "DAST did not complete; what it checks counts as not assessed." - It fails the stage, not the run. - The error goes to the log only, like the other stages; the DAST run keeps the scanner's reason. - The DAST scan drops its "Exploitation" phase, which was recorded as completed without doing anything. The enum variant stays for stored runs. - Docs (`features/dast.md`): what a target's scan does with DAST. **Tests:** - New `integration::api::dast::a_dast_scan_that_does_not_complete_is_a_failed_stage_of_the_run`: a target whose live URL does not resolve finishes its scan as completed, with one failed `dast` stage and a stored, failed DAST run. - On main's `graph_build.rs` the same test fails, because the run has no `dast` entry. - Locally against Mongo 7: the DAST integration tests, `cargo test -p compliance-dast`, and clippy for agent, core and dast with CI's flags. **Note:** a scan run now takes as long as its DAST scans, up to 20 minutes per DAST target. **Next parts of #998:** DAST findings in the main findings (point 2), the deterministic checks in every scan (point 3), SAST hints (point 4). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
sharang added 1 commit 2026-11-16 10:01:19 +00:00
feat(pipeline): the DAST stage waits for its scans and records a failure (#998)
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 4m26s
CI / Check (pull_request) Successful in 20m17s
3a34c5d795
`maybe_trigger_dast` started each DAST scan in a detached task. The scan
run never waited for it and a failed DAST scan was only a log line, so a
run read "completed" whether DAST ran or not.

- The stage now awaits each DAST target's scan, with a 20-minute limit,
  and stores its run and findings as before.
- A scan that fails, times out or cannot be stored is recorded as the
  `dast` stage with `ToolFailed` (subject "DAST", so the dashboard reads
  "DAST did not complete"). It fails the stage, not the run. The error
  goes to the log; the DAST run keeps the scanner's reason.
- The DAST scan drops its "Exploitation" phase, which was recorded as
  completed without doing anything. The variant stays for stored runs.
- Docs: what a target's scan does with DAST.

Test: a target whose live URL does not resolve finishes its scan with a
failed `dast` stage and a stored, failed DAST run. It fails on main,
where the run has no `dast` entry.

Part 1 of #998 (points 1 and 5). Findings in the main findings, the
deterministic checks and the SAST hints follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
sharang merged commit 4f5d713bbc into main 2026-11-16 10:30:45 +00:00
sharang deleted branch feat/dast-stage 2026-11-16 10:30:45 +00:00
Sign in to join this conversation.