Secrails LogoSECRAILS
Back to BlogDevSecOps & Code Security

DevSecOps Pipeline: Stages, Tools, and Real-World Examples

Secrails Team··9 min
DevSecOpsSASTCI/CD SecurityShift-Left SecurityContainer Image Scanning
DevSecOps pipeline diagram showing security stages from code commit to production deployment

Sixty-eight percent of organizations suffered a software supply chain attack in the past year, according to Sonatype's 2024 State of the Software Supply Chain report. Most of those breaches traced back to the same root cause: security bolted on at the end of delivery, long after the blast radius was already set. A DevSecOps pipeline solves exactly that — but only if you build it deliberately, not as a checkbox exercise.

This guide is for engineering and security teams who want practical architecture, not marketing fluff. We'll cover pipeline stages, the tools that actually work at scale, open-source options worth running, and a concrete example you can adapt for your own environment.

What a DevSecOps Pipeline Actually Is

Strip away the jargon and a DevSecOps pipeline is a CI/CD pipeline where security controls are first-class citizens — automated, enforced, and generating feedback fast enough for developers to act on it. The key word is automated. Manual security reviews inserted between sprints are not DevSecOps; they're just delayed auditing with a new name.

The shift-left principle means moving security checks as close to the developer's keyboard as possible. A vulnerability flagged in a pre-commit hook costs roughly $80 to fix. The same vulnerability discovered post-deployment can cost $7,600 or more, based on NIST's Software Assurance metrics. That asymmetry is the entire business case.

Done right, the pipeline enforces security policy as code — no ticket, no manual approval, no "we'll fix it in the next sprint." Policy violations block builds or trigger automated remediation. Done wrong, it floods developers with noise until they learn to ignore the scanner output entirely.

DevSecOps Pipeline Stages

A mature pipeline runs security checks across six distinct phases. Each phase has different tooling requirements, different failure modes, and different blast radius if skipped.

1. Pre-Commit and IDE

This is the earliest possible intervention point. Git hooks running tools like Gitleaks or Secret Detection catch hardcoded API keys and credentials before they ever reach a remote repository. SAST linting plugins in VS Code or JetBrains flag insecure function calls inline. The friction is low; the payoff is high. Secrets committed to a repo — even for thirty seconds — can be harvested by automated scanners that watch GitHub in real time.

2. Source Code Analysis (SAST)

Static Application Security Testing runs against the codebase without executing it. It catches SQL injection patterns, insecure deserialization, hardcoded credentials, and OWASP Top 10 vulnerabilities early in the build. Tools like Semgrep, Checkmarx, and the SAST capabilities in the Secrails platform integrate directly into pull request workflows, posting findings as code review comments. The signal-to-noise ratio matters enormously here — a SAST tool generating 400 false positives per sprint will get disabled by frustrated developers within two weeks.

3. Dependency and SCA Scanning

Software Composition Analysis (SCA) inventories your open-source dependencies and maps them against known CVEs, EPSS scores, and license obligations. This is where your SBOM (Software Bill of Materials) lives. Snyk, OWASP Dependency-Check, and Trivy all do this well. The integration point matters: SCA should run on every pull request, not just nightly. A critical dependency vulnerability introduced Monday morning should not survive to Friday's deploy.

4. Container Image Scanning

If your workloads run in containers — and most do — every image going into your registry needs a security scan before it gets tagged as deployable. Container Image Scanning checks base images, installed packages, and embedded secrets against known vulnerability databases. Trivy and Grype are solid open-source choices. For organizations on Kubernetes, scanning at the registry level is necessary but not sufficient; you also need admission controllers (OPA Gatekeeper, Kyverno) to block non-compliant images at runtime.

5. Infrastructure as Code (IaC) and Policy Checks

Terraform misconfigurations are responsible for a disproportionate share of cloud breaches — S3 buckets left public, security groups open to 0.0.0.0/0, encryption disabled. Checkov, KICS, and tfsec scan IaC files before they're ever applied. Combine this with Policy-as-Code enforcement that validates configurations against CIS Benchmarks and your internal baseline. If a Terraform plan opens port 22 to the world, the pipeline fails. Full stop.

6. Runtime and Post-Deployment

Security doesn't stop at deployment. Runtime protection covers behavioral anomaly detection (Falco for containers, eBPF-based tools), dynamic application security testing (DAST) against staging environments, and continuous VM vulnerability scanning for infrastructure that predates your shift-left initiative. This is also where CSPM tools monitor your cloud posture for drift between your intended configuration and what's actually running.

DevSecOps Pipeline Diagram — How the Stages Connect

Visualizing the pipeline helps teams understand handoffs and enforcement points. A simplified architecture looks like this:

Developer Workstation → Pre-Commit Hooks (Secret Scan, Lint) → Pull Request → SAST + SCA + IaC Scan → Build → Container Image Scan → Staging Deploy → DAST + Pen Test Automation → Production Deploy → Runtime Monitoring + CSPM + VM Scans

Each arrow represents an enforcement gate. At any stage, a critical finding should stop the pipeline and route a finding to the developer — with enough context to fix it, not just a raw CVE ID. The feedback loop is everything. A finding that takes four days to reach the developer who introduced it is not shift-left; it's shift-slightly-less-right.

In Kubernetes-native environments, the pipeline extends into the cluster itself: admission webhooks validate manifests on the fly, network policies enforce least-privilege communication, and Falco rules alert on abnormal syscall patterns that could indicate lateral movement or privilege escalation.

DevSecOps Pipeline Tools — What to Actually Use

There is no shortage of tools claiming DevSecOps compatibility. Here's an opinionated breakdown of what's worth deploying.

Best DevSecOps Tools by Category

SAST: Semgrep (fast, customizable rules, strong community), Checkmarx (enterprise, broad language support), Bandit (Python-specific, lightweight). For teams using Secrails, the built-in SAST module covers multi-language scanning with low false-positive tuning out of the box.

SCA / Dependency Scanning: Snyk (best developer UX, strong auto-remediation PR workflows), OWASP Dependency-Check (open source, reliable), Socket (supply chain focused, detects malicious packages beyond CVEs).

Secret Detection: Gitleaks (open source, fast, git-native), TruffleHog (deep git history scanning), Secrails Secret Detection for teams wanting centralized secret sprawl visibility across repositories and cloud.

Container Scanning: Trivy (open source, scans images + IaC + SBOMs, Aqua-backed), Grype (Anchore, fast and accurate), Snyk Container. For runtime, Falco is the de facto open-source standard for kernel-level behavioral detection.

IaC Scanning: Checkov (Bridgecrew/Palo Alto, 1000+ policies), KICS (Checkmarx open source, strong Terraform and CloudFormation support), tfsec (lightweight, Terraform-focused).

CSPM / Cloud Posture: Wiz dominates the enterprise market but comes with enterprise pricing. The Secrails CSPM platform offers continuous posture monitoring across AWS, Azure, and GCP with CIS Benchmark alignment and real-time drift detection — a strong option for teams wanting integrated pipeline-to-cloud coverage.

DevSecOps Tools Open Source — A Shortlist

For teams working with tighter budgets or preferring open-source stacks: Trivy covers container + IaC + SBOM scanning in a single binary. Semgrep OSS handles SAST across 30+ languages. Gitleaks catches secrets. Checkov handles IaC policy. Falco monitors runtime. OPA/Gatekeeper enforces Kubernetes admission policy. These five tools, properly integrated, cover the majority of a mature DevSecOps pipeline — the integration work is the real investment, not the licensing.

A Concrete DevSecOps Pipeline Example

Here's how a mid-size SaaS company — say, 80 engineers shipping to AWS — might structure their pipeline in GitHub Actions:

On every pull request: Semgrep runs SAST against changed files and posts inline comments. Trivy scans the dependency manifest. Gitleaks checks the commit diff for secrets. Checkov validates any Terraform changes. If any critical finding surfaces, the PR is blocked from merging. Developers see exactly which file and line number triggered the block.

On merge to main: A full image build triggers. Trivy scans the built container image against the full CVE database. If the image passes, it's pushed to ECR with a signed provenance attestation (Sigstore/Cosign). Kubernetes admission webhooks in staging verify the signature before scheduling the pod.

Nightly: DAST (OWASP ZAP or Burp Suite Enterprise) runs authenticated crawls against the staging environment. VM vulnerability scans run against EC2 instances. CSPM checks fire against the AWS account configuration. Findings flow into a single dashboard — not six separate tool portals — where the security team triages by EPSS score and asset criticality.

Post-incident: After any security event, the team runs a pipeline audit against NIST CSF 2.0 Detect and Respond functions to identify which stage should have caught the issue — and adds a regression test to ensure it would catch it next time.

This isn't hypothetical architecture. It's a pattern we see working consistently across teams that have moved past the "we installed a scanner" phase into actual security maturity. The Code Security approach at Secrails reflects exactly this kind of layered pipeline thinking.

Common DevSecOps Pipeline Failures

Alert fatigue is the most common failure mode. A pipeline generating 300 findings per build teaches developers to skip the security step. Tune your tools ruthlessly. Start with critical and high severities only. Add medium findings only after you've driven critical counts to near-zero.

The second failure: treating compliance as the end goal. SOC 2 and ISO 27001 checkboxes do not equal security. A pipeline that passes your compliance scanner but misses a Terraform misconfiguration opening your RDS instance to the public internet is worse than useless — it's false confidence. Real Vulnerability Management means continuous, risk-prioritized remediation, not quarterly audit prep.

Third: siloing security from developers. If findings route to a Jira backlog that product never prioritizes, the pipeline is security theater. Enforce blocking gates for critical issues. Make security findings part of the engineering team's Definition of Done, not a separate security team's queue.

Measuring Pipeline Effectiveness

The metrics that matter: Mean Time to Remediate (MTTR) critical vulnerabilities. Percentage of builds blocked by security gates versus passing clean. Secrets detected pre-commit versus post-commit (you want that ratio skewed heavily left). DAST finding regression rate — are the same vulnerability classes recurring sprint after sprint?

NIST CSF 2.0's new Govern function gives organizations a framework for tying these metrics to business risk. If your MTTR for critical container vulnerabilities is 45 days, you have a quantifiable risk exposure window you can translate directly into breach probability using EPSS data.

Teams serious about building this capability end-to-end should look at how SECRAILS integrates pipeline security controls with cloud posture management — because the pipeline and the runtime environment need to share the same security model, not operate as disconnected silos.

Frequently Asked Questions

What are the key stages of a DevSecOps pipeline?

A mature DevSecOps pipeline typically includes six stages: pre-commit secret and linting checks, static application security testing (SAST) on pull requests, software composition analysis (SCA) for dependency vulnerabilities, container image scanning before registry push, infrastructure as code (IaC) policy checks, and runtime monitoring post-deployment. Each stage has automated enforcement gates that block the pipeline on critical findings.

What are the best open source DevSecOps tools?

The most effective open-source DevSecOps stack combines Trivy (container image and IaC scanning), Semgrep OSS (SAST for 30+ languages), Gitleaks (secret detection), Checkov (IaC policy enforcement), and Falco (runtime behavioral detection). Together, these tools cover the majority of a mature pipeline without licensing costs — the real investment is integration and tuning.

How does a DevSecOps pipeline differ from a standard CI/CD pipeline?

A standard CI/CD pipeline focuses on build automation, testing, and deployment speed. A DevSecOps pipeline adds security controls as enforced gates at every stage — secret scanning, SAST, dependency checks, container scanning, and IaC policy validation — all automated and capable of blocking deployment on critical findings. The key difference is that security is a first-class requirement, not an afterthought appended at the end.

What is shift-left security and why does it matter?

Shift-left security means moving vulnerability detection earlier in the software development lifecycle — ideally to the developer's IDE or pre-commit stage — rather than finding issues during QA or after deployment. NIST data shows vulnerabilities found in pre-commit hooks cost roughly 80 dollars to remediate versus 7,600 dollars or more post-deployment. The earlier a vulnerability is caught, the cheaper and faster it is to fix.

How do you prevent alert fatigue in a DevSecOps pipeline?

Alert fatigue is one of the most common reasons DevSecOps initiatives fail. Start by enforcing only critical and high severity findings at the gate — do not block builds on medium or low findings until you've driven the critical count close to zero. Tune false positive rates aggressively for your specific tech stack, and route findings with full remediation context directly to the developer who introduced them, not to a shared security queue.

Secure Your Pipeline From Code to Cloud

Secrails integrates SAST, secret detection, container scanning, and cloud posture into a single platform — so your DevSecOps pipeline has no gaps.

Explore the Platform