Interview Prep/DevSecOps/DAST, runtime detection and compliance scans

`zap-baseline.py` fails the pipeline with exit code 2 even though the report has no high-risk alerts

BeginnerTroubleshootingDAST, runtime detection and compliance scans
Answer

Likely causes → The ZAP packaged scans exit with 1 when there are FAIL-level alerts, 2 when there are only WARN-level alerts, and 3 on errors. By default every rule is WARN, so any finding returns 2.

Diagnose → Read the summary at the end of the log, for example FAIL-NEW: 0 WARN-NEW: 7.

Fix → Generate a rules file, decide per rule, and run with it:

zap-baseline.py -t https://staging.acme.com -g gen.conf      # generate defaults
# edit to: 10038  FAIL  (Content Security Policy Header Not Set) ; 10027 IGNORE ...
zap-baseline.py -t https://staging.acme.com -c rules.tsv -I  # -I: don't fail on WARN

Prevent → Version the rules file and review IGNORE entries the way you review scanner suppressions.

All DevSecOps questions Roadmap: Policy as code

More on DAST, runtime detection and compliance scans