Cloud Tech by Victor
DevOpsIntermediate

Secure CI/CD Pipelines

How SAST, dependency (SCA) scanning, and DAST fit into a build pipeline as automated gates, and why failing the build on a real finding is what actually makes "shift-left" more than a slogan.

Updated 2026-07-243 min read

Overview

A secure pipeline treats security checks as automated build gates, not after-the-fact reports: SAST scans an application's own source code early, before any artifact exists, SCA scans third-party dependencies against known-vulnerability databases, since most shipped code is dependencies rather than code the team wrote, and DAST exercises a running instance of the application from the outside, closer to release. OWASP SAMM frames the maturity ladder for this plainly, at its highest level, a non-compliant artifact simply fails to build, which is what actually makes "shift-left" a control instead of a slogan; a scan result nobody is required to act on doesn't gate anything.

Quick Reference

CheckAnalyzesRuns againstTypical pipeline stage
SASTThe application's own source codeStatic code, no executionEarly build, before an artifact exists
SCAThird-party dependenciesKnown-vulnerability databasesBuild, alongside dependency resolution
DASTA running instance of the applicationLive HTTP traffic, black-boxLater, against a deployed staging environment

Syntax

yaml
# A build stage that fails the pipeline on a high-severity SCA
# finding, rather than only recording it for later review.
security-scan:
  script:
    - sca-scan --fail-on=high ./

Examples

yaml
# Gate the build on SAST findings the same way; the pipeline
# stops here, it doesn't continue and just flag the result.
sast-scan:
  stage: build
  script:
    - sast-scan --source . --fail-on-severity=high
  allow_failure: false

A finding that doesn't block the build is a suggestion, not a control

OWASP SAMM's highest build-process maturity level is explicit: define mandatory checks and make a non-compliant artifact actually fail to build. A scan that only produces a report for later review isn't shifting security left, it's just adding a dashboard.

Visual Diagram

Common Mistakes

  • Running SAST/SCA/DAST scans but configuring them to only report findings, never actually failing the build, so nothing is really gated.
  • Scanning only first-party source code and treating third-party dependencies as out of scope, when most of a modern application's code is dependencies.
  • Running DAST only against production, instead of a staging environment, turning a security test into a live-fire exercise against real users.
  • Adding every available scanner at once with default severity thresholds, generating enough noise that the team starts routinely overriding or ignoring failures.

Performance

  • SAST and SCA run against source/dependency manifests and add build time roughly proportional to codebase and dependency-tree size; incremental/cached scanning keeps this bounded on repeat runs.
  • DAST exercises a live running application and is meaningfully slower than SAST/SCA, which is part of why it typically runs later and less frequently in the pipeline, not on every single commit.

Best Practices

  • Configure every security check to actually fail the build on findings above an agreed severity threshold, not merely to report them.
  • Apply the same rigor to third-party dependency scanning (SCA) as to first-party source code (SAST); most shipped code isn't code the team wrote.
  • Run DAST against a staging deployment that mirrors production, not against production itself.
  • Tune severity thresholds deliberately so failures stay meaningful; a pipeline the team routinely overrides has stopped functioning as a gate.

Interview questions

What is the difference between SAST, SCA, and DAST, and where does each run in a pipeline?

SAST (static application security testing) analyzes an application's own source code without running it, catching issues like injection-prone patterns early in the build stage, before an artifact even exists. SCA (software composition analysis) scans a project's third-party dependencies against known-vulnerability databases, since most of a modern application's code is dependencies, not code the team wrote itself. DAST (dynamic application security testing) tests a running instance of the application from the outside, the way an attacker would, and so it runs later, typically against a deployed staging environment, after the artifact exists and is running somewhere.

According to OWASP SAMM, what should happen at the highest maturity level when a security check fails during the build?

At the highest build-process maturity level, organizations define mandatory security checks and ensure that building a non-compliant artifact actually fails, the pipeline is configured to stop, not just record a finding for someone to look at later. This is the difference between security scanning that genuinely gates what gets shipped and scanning that only produces a report nobody acts on; a finding that doesn't block the build in practice functions as a suggestion, not a control.

Why does OWASP SAMM recommend treating third-party dependencies with the same security rigor as internal code?

Modern applications are typically built from far more third-party dependency code than code the team actually wrote, so a security process that only scrutinizes internal code is scrutinizing a small fraction of what actually ships. SAMM's guidance moves from simply maintaining a Bill of Materials, to actively evaluating dependencies and responding to known risks, to applying the same rigorous analysis given to internal code, precisely because a vulnerable dependency is exploitable in production exactly like a vulnerability the team wrote themselves, regardless of who authored the code.

References

ShareXLinkedInReddit
Was this page helpful?
Suggest an improvement