OWASP ZAP DAST··6 min read

Automating OAuth2 and SPA logins in OWASP ZAP without plaintext secrets

Most automated DAST pipelines stall on 401 gates. Pair ZAP Automation Framework plans with runtime placeholders and pre-scan session assertions.

Key takeaway

Use environment placeholders in plan.yaml and gate every scan with a requestor + stats assertion verifying logged-in session state.

Catch 401 failures in 5 seconds, not 20 minutes

Running active or spider jobs without checking whether authentication succeeded wastes runner minutes scanning a login screen. Adding a requestor job targeting a protected profile endpoint alongside stats.auth.state.loggedin >= 1 fails fast if credentials expire.