Safeguard
Developer Tools•

How do I run DAST in CI without slowing every build?

Run a short passive baseline on every merge, a deeper active scan nightly or pre-release, and decide up front which exit codes fail the pipeline.

Safeguard Security Team
3 min read

To run DAST in CI without slowing builds, run a short passive baseline scan on each merge, run the deeper active scan on a nightly or pre-release schedule, and decide in advance which results fail the pipeline. Fast checks gate merges. Slow checks report on a timer.

Two tiers

TierWhenScanTime budgetBlocks merge
FastEvery mergePassive baselineA few minutesOn chosen rules
DeepNightly or releaseAuthenticated active scanSet a wall clock capOpens tickets, blocks release

ZAP's baseline script is built for this. Its documentation says it runs a spider for one minute by default, waits for passive scanning, performs no attacks and runs for a few minutes at most. The full scan has no spider time limit by default, so cap it yourself.

Exit codes

The ZAP scan scripts return 0 for success, 1 if any rule is set to fail, 2 if there are warnings and no failures, and 3 for other failures. By default every alert is a warning, so a fresh setup returns 2 and many pipelines treat that as pass. Choose on purpose.

Steps

  1. Deploy the build to an ephemeral or shared staging environment before the scan job.
  2. Run the baseline against it with a report output.
  3. Generate a config file, then set noisy rules to ignore and the rules you care about to fail.
  4. Store the report as a build artifact so reviewers can open it.
  5. Schedule the active scan with a time cap and an authenticated test account.
  6. Route results to your tracker with a severity filter so developers see a short list.
  7. Review the config monthly, because rules change and apps change.

Avoiding flaky runs

Wait for the deploy to be healthy before scanning. Use stable test data. Give the scan its own account so rate limits and lockouts do not hit other tests. Never point CI scans at production by default.

What to gate on

Start with a small blocking set: missing transport security, exposed secrets in responses, and clear injection findings. Expand as the noise drops. A gate nobody trusts gets disabled.

Try it yourself

Open the gate demo and see how a failing check blocks a change before merge.

Click through it at your own pace, or open it full screen.

Quick check

Should DAST block every pull request?

Usually only a fast passive check. Deep active scans run on a schedule so developers are not waiting.

What does exit code 2 mean?

ZAP's scripts use it for warnings with no failures. Treat it as pass or fail by your own policy.

Where Safeguard fits

Safeguard offers dependency and SBOM scanning, reachability analysis and policies and gates that can block a pull request, so the libraries behind your app are checked alongside the app itself. You can try a free scan at gold.safeguard.sh/scan.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.