Interview Prep/DevSecOps/Pipeline Security Scanning

You are asked to add security to an existing CI pipeline. Where do SAST, SCA, secrets scanning and DAST each go?

BeginnerScenarioPipeline Security Scanning
Answer

Situation read → Classic "shift left" design question. Each scan type needs a different artifact, so each lands at a different stage.

What I'd do →

  1. Pre-commit and PR: secrets scan (gitleaks) and fast SAST (semgrep) on the diff only.
  2. Build stage: SCA against lockfiles (trivy fs, osv-scanner) and IaC scan (checkov, trivy config).
  3. After image build: image scan (trivy image), SBOM generation, signing.
  4. After deploy to staging: DAST (ZAP baseline) against the running app.
  5. Production: runtime detection and continuous re-scan of SBOMs.

Why → SAST and SCA need only source, so they run before anything is built. DAST needs a running target, so it can only run after deploy.

Interview tip → Say "cheap and fast scans block the PR, slow scans run nightly or post-deploy".

All DevSecOps questions Roadmap: Security in the pipeline

More on Pipeline Security Scanning