What is the difference between SAST and DAST?
BeginnerConceptOWASP ZAP
Answer
Short answer
SAST (Static Application Security Testing) analyses source code without running it — like proofreading a recipe. DAST (Dynamic Application Security Testing) tests a running application from the outside, the way an attacker would — sending requests and looking at responses — like taste-testing the finished dish. You need both.
Comparison
| SAST | DAST | |
|---|---|---|
| Tests | Source code | Running app (HTTP) |
| When | Early — every PR | Later — after deploying to a test/staging env |
| Needs running app | No | Yes |
| Language-specific | Yes | No (black box) |
| Finds | Injection patterns in code, insecure APIs, hard-coded secrets | Missing security headers, XSS, SQLi actually exploitable, misconfigured TLS/cookies, server errors |
| Points to code line | ✅ | ❌ (points to URL/parameter) |
| Tools | SonarQube, Semgrep, CodeQL | OWASP ZAP, Burp Suite, Nuclei |
Where each runs in a pipeline
commit → Gitleaks → SonarQube (SAST) → Trivy (SCA/image) → deploy to staging → ZAP (DAST) → prod
What to say in the interview
"SAST reviews code without running it and gives early, line-level feedback; DAST attacks the running app from outside and finds runtime issues like missing headers or exploitable injection. We run SAST on PRs and DAST against staging after deployment."
More on OWASP ZAP
What is OWASP ZAP and how do you run a DAST scan?BeginnerWhat is OWASP ZAP?BeginnerWhat is the difference between a ZAP baseline scan and a full scan?BeginnerHow do you run a ZAP baseline scan with Docker?BeginnerHow do you read a ZAP report?BeginnerHow do you add ZAP to a CI/CD pipeline?Intermediate