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:

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:

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:

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:

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:

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:

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:

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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:

Common Mistakes

Getting Started: The Two-Week Plan

You don't need all six stages on day one. Here's a practical rollout:

Week 1:

Week 2:

Month 2:

Month 3:

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

Advertisement