DevSecOps Pipeline Guide 2026: How to Embed Security Into Every Stage of CI/CD
Most teams bolt security onto the end of their pipeline. Here's how to weave it into every stage β with specific tools, configurations, and lessons from teams that actually ship secure code fast.
Key Takeaways
- Six scanning stages cover the full attack surface: secret scanning β SAST β SCA β container scanning β IaC scanning β DAST
- Start with two tools β a secret scanner and an SCA scanner give you the highest ROI for the least integration effort
- Fail builds only on critical/high β teams that fail on medium findings abandon the pipeline within a month
- Baseline files are essential β suppress known issues so developers only see new findings on their PRs
- Measure mean-time-to-remediate, not finding count β the goal is fixing vulnerabilities, not generating reports
Why DevSecOps in 2026 Looks Different
Three years ago, "DevSecOps" meant adding a SAST scan to your CI pipeline and calling it done. In 2026, the attack surface has expanded β containers, infrastructure-as-code, API-first architectures, AI-generated code β and the tooling has matured to match.
The teams getting this right aren't running more tools. They're running the right tools at the right stages with sane thresholds. This guide walks through each pipeline stage, the tools that work, and the configuration decisions that determine whether your DevSecOps pipeline actually catches vulnerabilities or just generates noise.
The Six Stages of a DevSecOps Pipeline
A mature DevSecOps pipeline has security checks at six distinct points. Each stage catches a different class of vulnerability, and skipping any one of them leaves a gap that attackers will find.
Stage 1: Pre-Commit β Secret Scanning
The cheapest vulnerability to fix is the one that never reaches the repository. Secret scanning catches hardcoded API keys, database passwords, and private keys before they enter version control.
Tools:
- Gitleaks β Fast, regex-based, runs as a pre-commit hook or CI step. Open source.
- TruffleHog β Entropy-based detection plus regex. Better at catching custom secret formats. Open source.
- GitHub Secret Scanning β Built into GitHub, scans pushes automatically. Free for public repos, paid for private.
Configuration that matters: Run Gitleaks as a pre-commit hook and as a CI step. Developers bypass pre-commit hooks (intentionally or accidentally). The CI step is your safety net. Use a .gitleaks.toml allowlist for test fixtures and documentation examples β otherwise false positives on example API keys will train developers to ignore all findings.
Stage 2: Build β Static Application Security Testing (SAST)
SAST analyzes source code without executing it. It catches injection patterns, insecure cryptography, hardcoded credentials that secret scanners miss, and logic flaws in authentication code.
Tools:
- Semgrep β Pattern-based, fast, supports 30+ languages. The community ruleset covers OWASP Top 10. Open source core.
- CodeQL β Semantic analysis, deeper than pattern matching. Catches data flow issues Semgrep misses. Free for open source on GitHub.
- SonarQube β Broad language support, quality + security in one tool. Community edition is free; security rules require paid tiers.
Configuration that matters: Start with Semgrep's p/owasp-top-ten ruleset. It's opinionated and has low false positive rates. Add CodeQL for repositories with complex data flows (authentication services, payment processing). Don't run both on every repo β the overlap generates duplicate findings that waste developer time. See our DAST vs SAST comparison for detailed tool selection guidance.
Stage 3: Dependencies β Software Composition Analysis (SCA)
80% of the code in your application is third-party dependencies. SCA scans your dependency tree for known vulnerabilities (CVEs) and license compliance issues.
Tools:
- Trivy β Scans OS packages, language dependencies, and container images. One tool for SCA + container scanning. Open source.
- Snyk β Developer-friendly, auto-generates fix PRs. Free tier covers most small teams.
- Dependabot β Built into GitHub. Automated dependency update PRs. Free.
- Grype β Anchore's open source vulnerability scanner. Fast, good for CI pipelines.
Configuration that matters: SCA tools generate the most noise of any pipeline stage. A typical Node.js project has 500+ transitive dependencies, and many CVEs are in dependencies you don't actually call. Use reachability analysis (Snyk and Trivy both support this) to filter findings to vulnerabilities in code paths your application actually executes. This typically reduces findings by 60-80%.
Stage 4: Container Build β Image Scanning
If you deploy containers, every image needs scanning before it reaches a registry. Container images inherit vulnerabilities from base images, OS packages, and application dependencies.
Tools:
- Trivy β Scans images, filesystems, and git repos. The most versatile option.
- Grype β Fast image scanning with SBOM generation via Syft.
- Docker Scout β Built into Docker Desktop. Good for local development scanning.
Configuration that matters: Scan images in CI after build but before push to the registry. Use a distroless or minimal base image (Alpine, Chainguard) to reduce the vulnerability surface. Pin base image digests, not tags β FROM node:20@sha256:abc123 not FROM node:20. Tags are mutable; digests are not. See our container security scanning guide for detailed workflows.
Stage 5: Infrastructure β IaC Scanning
Infrastructure-as-code (Terraform, CloudFormation, Kubernetes manifests) defines your production environment. Misconfigurations here create vulnerabilities that no amount of application security can fix β public S3 buckets, overly permissive security groups, unencrypted databases.
Tools:
- Checkov β Scans Terraform, CloudFormation, Kubernetes, Helm, and Dockerfiles. 1000+ built-in policies. Open source.
- tfsec β Terraform-specific, fast, good defaults. Now part of Trivy.
- KICS β Checkmarx's open source IaC scanner. Broad format support.
Configuration that matters: IaC scanning has the highest signal-to-noise ratio of any pipeline stage. Most findings are real misconfigurations, not false positives. Run Checkov on every PR that touches .tf, .yaml, or Dockerfile files. Fail the build on high severity β an unencrypted RDS instance or a public S3 bucket should never reach production.
Stage 6: Post-Deploy β Dynamic Application Security Testing (DAST)
DAST tests the running application from the outside, finding vulnerabilities that only manifest at runtime β misconfigurations, authentication bypass, CORS issues, and server-side vulnerabilities that static analysis can't see.
Tools:
- OWASP ZAP β The standard open source DAST tool. Automated scanning + manual testing. See our ZAP vs Burp Suite comparison.
- Nuclei β Template-based scanning. Fast, extensible, great for known vulnerability checks. See our Nuclei comparison.
- Burp Suite β The professional's choice. Expensive but thorough. See our Burp Suite pricing breakdown.
Configuration that matters: DAST is the slowest stage β a full ZAP scan can take hours. Run a baseline scan (5-10 minutes) on every PR against a staging environment. Run a full scan nightly or weekly. Use ZAP's automation framework to define scan policies that match your application's technology stack. See our ZAP + GitHub Actions guide for CI integration.
Pipeline Architecture: Putting It Together
Here's how the six stages map to a typical CI/CD pipeline:
βββββββββββββββ ββββββββββββ ββββββββββββ βββββββββββββ ββββββββββββ ββββββββββββ
β Pre-Commit β β β Build β β β Test β β β Package β β β Deploy β β β Verify β
β β β β β β β β β β β β
β β’ Gitleaks β β β’ Semgrepβ β β’ Trivy β β β’ Trivy β β β’ Checkovβ β β’ ZAP β
β β’ TruffleHog β β β’ CodeQL β β (SCA) β β (image) β β β’ tfsec β β β’ Nuclei β
βββββββββββββββ ββββββββββββ ββββββββββββ βββββββββββββ ββββββββββββ ββββββββββββ
Secrets SAST Dependencies Containers IaC DAST
Key principle: Each stage gates the next. If secret scanning fails, SAST doesn't run. If SAST fails, the build doesn't proceed. This prevents wasting CI minutes on code that's already known to be insecure.
The Alert Fatigue Problem (And How to Solve It)
The number one reason DevSecOps pipelines fail isn't tooling β it's alert fatigue. A fresh pipeline on a mature codebase will generate hundreds of findings on day one. Developers ignore them all, and within a month the security checks are either disabled or permanently bypassed.
How to avoid this:
- Baseline on day one. Run all tools against your main branch and save the results as a baseline. Only show developers new findings introduced by their PR. Gitleaks, Semgrep, and Trivy all support baseline files.
- Fail only on critical and high. Medium and low findings go to a dashboard, not a build failure. Teams that fail on medium abandon the pipeline.
- Deduplicate across tools. Semgrep and CodeQL will find the same SQL injection. Use a findings aggregator (DefectDojo, SARIF dashboards) to deduplicate before routing to developers.
- Assign findings to code owners. A finding in the auth service goes to the auth team, not "the security backlog." Use CODEOWNERS files to route automatically.
- Review rules quarterly. Disable rules with >50% false positive rates. Add custom rules for patterns specific to your codebase.
Metrics That Matter
Track these four metrics to measure whether your DevSecOps pipeline is actually improving security:
- Mean Time to Remediate (MTTR) β How long from finding to fix? Target: <7 days for critical, <30 days for high.
- Escape Rate β What percentage of production vulnerabilities were missed by the pipeline? This measures pipeline effectiveness.
- False Positive Rate β What percentage of findings are not real vulnerabilities? Above 30% and developers stop trusting the tools.
- Pipeline Pass Rate β What percentage of builds pass security checks? Below 70% means thresholds are too aggressive.
Common Mistakes
- Running every tool on every repo. A static marketing site doesn't need DAST. A CLI tool doesn't need container scanning. Match tools to the application's attack surface.
- Treating DevSecOps as a tool problem. Tools find vulnerabilities. People fix them. If developers don't have time allocated for remediation, findings pile up and the pipeline becomes decoration.
- Skipping IaC scanning. The most impactful vulnerabilities in 2026 are infrastructure misconfigurations, not application code bugs. A public S3 bucket or an overly permissive IAM role causes more damage than a reflected XSS.
- Not scanning AI-generated code. AI coding assistants generate code with known vulnerability patterns. SAST is more important in 2026 than it was in 2023 precisely because more code is generated, not written.
Getting Started: The Two-Week Plan
You don't need all six stages on day one. Here's a practical rollout:
Week 1:
- Add Gitleaks to CI (secret scanning). Baseline existing findings.
- Add Trivy for dependency scanning (SCA). Fail on critical CVEs only.
Week 2:
- Add Semgrep with the OWASP Top 10 ruleset (SAST). Baseline existing findings.
- If you use containers, add Trivy image scanning.
Month 2:
- Add Checkov for IaC scanning if you manage infrastructure.
- Add ZAP baseline scans against staging.
Month 3:
- Set up a findings dashboard (DefectDojo or GitHub Security tab).
- Establish MTTR targets and start tracking metrics.
This incremental approach lets developers adapt to each tool before adding the next one. Teams that deploy all six stages simultaneously overwhelm developers and end up rolling everything back.
Further Reading
- Building an Automated Security Scanning Pipeline: From Zero to Full OWASP Coverage in CI/CD
- DAST vs SAST in 2026: Which Approach Does Your Team Need?
- Container Security Scanning in 2026: Tools, Workflows, and What Matters
- OWASP Top 10 Testing Guide Hub
- Writing Nuclei Templates: A Practical Guide
- Security Scanner Comparison Hub
- Web Application Security Testing Checklist for 2026
- API Security Testing: 10 Checks Every API Needs
- GraphQL Security Testing in 2026
- OWASP API Security Top 10 Guide