Shift-Left Security: SAST, SCA and DAST
Add automated security testing to pipelines, from source code and dependencies to IaC, containers and running applications.
Intermediate · about 6 hours · difficulty 3/5
Learn first: Continuous Integration and Delivery, Container Security Essentials
DevSecOps means security is part of the everyday pipeline instead of a gate at the end. The practical core is a set of automated scanners, each looking at a different layer, plus a sane process for acting on what they find.
Know the common web risks
The OWASP Top 10 (broken access control, injection, cryptographic failures, misconfiguration, vulnerable components and so on) is the shared vocabulary between developers and security teams. You do not need to be a pentester, but you should recognise each class.
Types of scanning
- Secret scanning: gitleaks, trufflehog, Git host push protection.
- SAST (static analysis of source): Semgrep, CodeQL, SonarQube. Finds injection patterns and unsafe APIs before code runs.
- SCA (software composition analysis): Dependabot, Renovate, Snyk, OSV-Scanner,
npm audit. Finds known CVEs in dependencies and keeps them updated. - IaC scanning: Checkov, Trivy, tfsec rules. Catches public buckets and open security groups at plan time.
- Container image scanning: Trivy, Grype, registry-native scanners.
- DAST (dynamic testing of a running app): OWASP ZAP against staging finds missing headers, auth issues and reflected input.
Making it work in practice
- Run fast scanners on every pull request and slower ones nightly.
- Fail builds only on high-confidence, high-severity findings at first; report the rest.
- Triage with severity and exploitability, and track exceptions with expiry dates.
- Automate dependency updates so patches arrive as small, reviewable pull requests.
Good enough to move on: you can add secret, SAST, SCA, IaC and image scanning to a pipeline with a sensible failure threshold, run a ZAP baseline scan against staging, and explain the difference between SAST and DAST.
Key concepts
- OWASP Top 10
- Secret scanning
- SAST with Semgrep or CodeQL
- SCA and automated dependency updates
- IaC scanning with Checkov or Trivy
- Container image scanning
- DAST with OWASP ZAP
- Triage, thresholds and exceptions
Mini project
Add gitleaks, Semgrep, Dependabot or Renovate, Checkov and Trivy to a repository's pipeline, fail only on critical findings, and run a nightly OWASP ZAP baseline scan against a staging deployment.
Check yourself
Which scanner type would catch a SQL injection in your code, which would catch a vulnerable version of a logging library, and which would catch a missing security header?
Free resources
- OWASP Top Ten (OWASP)
- Semgrep documentation (Semgrep)
- Trivy documentation (Aqua Security)
- ZAP documentation (ZAP)