How DevSecOps Shifts Security Left, Phase by Phase

How DevSecOps shifts security left in the SDLC: what to check at design, commit, PR, build and deploy, when to block, who owns fixes and how to measure it.

Aug 22, 2025 - 15:20
Nov 5, 2026 - 11:31
 0  68
TOPICDevOps BasicsPractical guide
How DevSecOps Shifts Security Left, Phase by Phase

DevSecOps shifts security left by moving security checks to the earliest point in the software development lifecycle where a problem can be found and fixed cheaply: threat modeling during design, secret and code scanning on the developer's machine and in pull requests, dependency and image checks at build time, and policy checks before deployment. Production monitoring then closes the loop.

This guide walks through each SDLC phase, shows what to check there, who owns the result, and when a finding should warn or block. For the wider picture of how DevSecOps fits into DevOps, start with What Is DevOps? and then come back here.

Key takeaways

  • "Shift left" means moving a check earlier in the lifecycle, to the place where the person who caused the issue is still working on that code.
  • Each phase has a natural security check: threat modeling in design, secret scanning and linting in the editor and pre-commit, SAST and dependency scanning in pull requests, SBOMs and image scanning at build, signature and policy checks at deploy.
  • Most programs fail on noise, not tooling. Start new checks in warn mode, block only on high-confidence findings, and tune before you tighten.
  • Shifting left does not mean handing all security work to developers. Security engineers still own policy, tool tuning, threat models and incident response.
  • NIST SP 800-218 (the Secure Software Development Framework) and SLSA give you a vendor-neutral way to describe what "secure by default" should look like.
  • Pair shift-left checks with production monitoring ("shift right"), because some issues only appear at runtime.

What "shift left" actually means

Picture the SDLC drawn as a line from left to right: plan, design, code, build, test, release, deploy, operate. In a traditional model, security review sat near the right end. A separate team ran a penetration test or a review shortly before release, filed a long list of findings, and the release either slipped or shipped with known issues.

Shifting left moves those checks toward the start of the line. The logic is simple. A developer who sees a hardcoded password warning seconds after typing it fixes it in a few seconds. The same password found in a release review two months later needs a ticket, a context switch, a credential rotation and a new build. The fix cost grows with distance from the moment the mistake was made.

You will often see a claim that a bug costs "100 times more" to fix in production. The exact multiplier is widely repeated and poorly sourced, so do not put it in a business case. The direction of the effect is not controversial, though, and you can measure it in your own pipeline by tracking how long findings stay open by the stage where they were found.

Shift-left checks by SDLC phase

This table is the core of a shift-left program. Each row is a phase, the check that fits there, and how fast the feedback reaches the person who can act on it.

PhaseSecurity activityExample tools or methodsFeedback timeDefault action
Plan and designThreat modeling, security requirements, abuse casesSTRIDE sessions, OWASP Threat Dragon, design review checklistDaysDesign changes before code
Code (editor)Linting, secret detection, insecure pattern hintsIDE plugins for SAST and SCA, editor secret detectorsSecondsInform only
CommitPre-commit hooks for secrets and formattingpre-commit framework, gitleaks, detect-secretsSecondsBlock the commit locally
PushServer-side secret blockingGitHub push protection, GitLab secret push protectionSecondsBlock the push
Pull requestSAST, dependency (SCA) scanning, IaC scanning, reviewSemgrep, CodeQL, Snyk, Checkmarx, Trivy, CheckovMinutesComment, block on high severity
BuildSBOM generation, container image scanning, signingSyft, Trivy, Grype, Cosign (Sigstore)MinutesBlock on critical, fixable issues
TestDAST against a running test environmentOWASP ZAPMinutes to hoursReport, block on confirmed issues
DeployAdmission policy, signature verification, config policyKyverno, OPA Gatekeeper, Kubernetes Pod Security AdmissionSecondsReject non-compliant workloads
OperateRuntime detection, logs, vulnerability re-scansFalco, cloud security posture tools, SIEMContinuousAlert and respond

For a stage-by-stage tool comparison, see 12 DevSecOps Tools for Secure CI/CD. This article is about how to place and run these checks, so the tool names here are examples rather than recommendations.

Phase 1: plan and design

The earliest point to find a security flaw is before any code exists. A design flaw, such as an internal API with no authentication or a file upload that is processed by a privileged service, cannot be fixed by a scanner later. Scanners find bugs in code; they rarely find a missing control.

Threat modeling answers four questions for a feature: what are we building, what can go wrong, what are we going to do about it, and did we do a good job. Keep it light. A 45-minute session with the developer, a tester and someone from security, drawing the data flow on a whiteboard and walking through STRIDE categories (spoofing, tampering, repudiation, information disclosure, denial of service, elevation of privilege), catches most design gaps for a typical feature.

Output from this phase should be concrete: a short list of security requirements added to the user story, such as "upload size limited to 10 MB" or "service account has read-only access to bucket X". These become test cases later. Our post on threat modeling tools for DevSecOps pipelines compares tools that help you keep threat models in version control next to the code.

Phase 2: code, on the developer's machine

The fastest feedback loop is the editor. Most commercial and open source SAST and SCA tools ship IDE plugins that flag a vulnerable dependency or an injection-prone pattern as the developer types. Treat these as hints. They should never block anything, because developers will disable a plugin that interrupts them with false positives.

The commit is the next point. A pre-commit hook runs on the developer's machine before Git records the commit. It is the right place for cheap, high-confidence checks: secret detection, formatting, and simple linting. Here is a minimal configuration for the pre-commit framework with a secret scanner:

# .pre-commit-config.yaml
repos:
  - repo: https://github.com/gitleaks/gitleaks
    rev: v8.18.4   # pin to a release you have tested
    hooks:
      - id: gitleaks
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.6.0
    hooks:
      - id: detect-private-key
      - id: check-added-large-files

Developers install it once with pre-commit install. Pin the rev values to versions you have tested and update them on a schedule. A full walkthrough is in Enforce Repo Standards with Pre-Commit Hooks in Git.

Local hooks can be skipped with git commit --no-verify, so they are a convenience, not a control. The control is server-side. GitHub secret scanning with push protection blocks pushes that contain recognised credentials before they reach the repository, and GitLab has an equivalent secret push protection feature. Turn these on for every repository, then handle the rare bypass requests through a documented process. Guidance on what to do once a secret is already in history is in our post on storing secrets in Git repositories.

Phase 3: pull request

The pull request is where most shift-left programs put their main checks, and for good reason. The code is complete enough to analyse, the author is still focused on it, and a reviewer is already looking. Findings posted as PR comments on the exact changed lines get fixed far more often than findings in a separate dashboard.

Run three kinds of scan here:

  • SAST (static application security testing) reads source code for patterns such as SQL built from user input, unsafe deserialisation or weak crypto calls.
  • SCA (software composition analysis) checks your dependency manifests and lockfiles against vulnerability databases. For most applications, this finds more real, exploitable issues than SAST, because most of the code you ship is third-party.
  • IaC scanning checks Terraform, Kubernetes manifests, Helm charts and Dockerfiles for misconfigurations such as public storage buckets, containers running as root or missing resource limits.

Scan only the diff where your tool supports it. A PR that touches two files should not fail because of 400 old findings in the rest of the repository. Handle the backlog separately, as planned work.

A minimal GitLab CI example that adds GitLab's own SAST and dependency scanning templates looks like this:

include:
  - template: Jobs/SAST.gitlab-ci.yml
  - template: Jobs/Dependency-Scanning.gitlab-ci.yml
  - template: Jobs/Secret-Detection.gitlab-ci.yml

stages:
  - build
  - test

Check the template names against the GitLab documentation for your version before you copy this; GitLab updates its security templates regularly.

Phase 4: build

At build time you know exactly which packages went into the artifact. Three things belong here.

First, generate a software bill of materials (SBOM) in a standard format such as SPDX or CycloneDX and store it with the artifact. When a new vulnerability is announced next month, you can search your SBOMs instead of rebuilding everything to find out what is affected.

Second, scan the container image. Base images bring operating system packages with their own CVEs. A useful default is to fail the build only on critical vulnerabilities that already have a fixed version available, since those are the ones the developer can actually resolve by bumping a version.

# Fail the build on fixable critical issues only
trivy image --severity CRITICAL --ignore-unfixed --exit-code 1 registry.example.com/app:${CI_COMMIT_SHA}

Third, sign the image and record provenance. Sigstore's Cosign is a common choice. Signed images let the deploy phase verify that what runs in the cluster came from your pipeline. The SLSA specification (currently version 1.2, with Build and Source tracks) describes provenance levels you can aim for.

Phase 5: test

Dynamic application security testing (DAST) attacks a running copy of the application from the outside, the way a scanner on the internet would. It finds issues that static analysis cannot see, such as missing security headers, misconfigured TLS, or an authentication bypass caused by how two services interact.

DAST is slower than SAST, so run a short baseline scan on every merge to the main branch and a full scan nightly against a staging environment. Our guide on integrating OWASP ZAP into a CI/CD pipeline shows both patterns.

Phase 6: deploy

The deploy phase is the last gate before production, and it is the one gate a developer cannot skip by editing a pipeline file. In Kubernetes this means admission control:

  • Pod Security Admission, built into Kubernetes, enforces the Privileged, Baseline or Restricted pod security standard per namespace.
  • A policy engine such as Kyverno or OPA Gatekeeper enforces your own rules: images only from approved registries, required labels, no latest tags, and signature verification.

Write these policies as code, keep them in Git, and test them in CI like any other code. Start them in audit mode, look at what would have been rejected for a week or two, and then switch to enforce.

Phase 7: operate (the "shift right" half)

Some problems only exist at runtime: a new CVE in a library you already shipped, a compromised credential, an unexpected shell inside a container. Shift-left checks cannot catch these, so a mature program also invests in runtime detection, continuous re-scanning of deployed images against fresh vulnerability data, and centralised logs.

Feed what you learn back to the left. If an incident started with a misconfiguration, add a policy that blocks it at deploy time. If a vulnerability class keeps appearing, add a SAST rule for it and a line in the threat modeling checklist.

Warn or block: setting gating policy

The single decision that most affects whether developers accept a shift-left program is which findings block a merge. Block too little and the checks are ignored. Block too much, especially on false positives, and developers learn to bypass the pipeline.

Finding typeSuggested defaultReason
Verified secret (matches a known provider format)BlockHigh confidence, high impact, easy to fix before merge
Critical or high CVE with a fix availableBlockDeveloper can resolve it by upgrading
Critical CVE with no fixWarn and trackBlocking gives the developer nothing to do
SAST high severity, well-tuned ruleBlockOnly after the rule has a low false positive rate in your code
SAST medium or lowComment onlyToo noisy to block
IaC misconfiguration in production modulesBlockCheap to fix, expensive if deployed
Licence policy violationBlock or route to reviewDepends on your legal policy

Every block needs an exception path: a way to mark a finding as a false positive or accepted risk, with a reason and an expiry date, reviewed by someone outside the team. Without that path, people find their own way around the gate.

Who owns what after the shift

A common failure is to read "shift left" as "developers now do security". That moves work without moving the knowledge. A better split looks like this:

  • Developers fix findings in their own code and dependencies, write tests for security requirements, and take part in threat modeling.
  • Security engineers choose and tune tools, write and maintain policies and custom rules, run threat modeling sessions, triage the hard findings, and handle incidents.
  • Platform or DevOps engineers build the checks into shared pipeline templates so every team gets them by default, and keep scan times low.
  • Security champions, one per team, are developers with extra training who answer first-line questions and bring team feedback to the security group.

Who controls production access is a related question, covered in Who Controls Production Access in DevSecOps?

Mapping the program to NIST SSDF

If you need to explain your shift-left work to auditors or customers, NIST SP 800-218, the Secure Software Development Framework (SSDF) version 1.1, published in February 2022, is a widely used reference. It groups practices into four areas: prepare the organisation, protect the software, produce well-secured software, and respond to vulnerabilities. Most of the checks in this article sit under "produce well-secured software", while SBOMs and signing support "protect the software" and runtime monitoring supports "respond to vulnerabilities".

Measuring whether shift left is working

Track a few numbers from the start so you can tell if the program helps:

  • Where findings are caught. The share of findings caught at commit or PR versus later stages should rise over time.
  • Time to remediate by severity and by stage found.
  • False positive rate per tool and per rule, based on developer dismissals that security confirms.
  • Pipeline time added by security jobs. If a PR pipeline grows from 6 minutes to 25, developers will notice before anyone else does.
  • Vulnerabilities reaching production, from runtime re-scans and incidents.

A rollout order that works

  1. Turn on server-side secret push protection everywhere. It is cheap and high value.
  2. Add dependency scanning to PRs in warn mode, then block on fixable critical issues.
  3. Add image scanning and SBOM generation to builds.
  4. Add SAST with a small, tuned rule set, starting in comment-only mode.
  5. Add IaC scanning for Terraform and Kubernetes manifests.
  6. Introduce admission policies in audit mode, then enforce.
  7. Start lightweight threat modeling for new features and high-risk changes.
  8. Add DAST and runtime detection as the program matures.

Each step should be in shared pipeline templates, not copied by hand into every repository. For how the pieces connect, read 12 Key Components of a DevSecOps Architecture.

Common mistakes

  • Turning every scanner on in blocking mode on day one. The first week produces hundreds of findings, the team calls security a blocker, and the checks get disabled.
  • Scanning the whole repository on every PR. Old findings drown out the new ones the author can fix.
  • Relying on local hooks as a control. They are easy to skip. Use server-side checks for anything that must hold.
  • Buying tools without owners. A scanner nobody tunes becomes a noise generator within months.
  • Forgetting the right side. No pipeline catches a CVE published after you deployed.

Learn DevSecOps hands-on

If you want to build these pipelines yourself with guided labs, our DevSecOps training covers secret scanning, SAST, SCA, image scanning, signing and admission policies. Classes run in our Kharadi, Pune classroom and live online across India.

Frequently asked questions

What does shift left mean in DevSecOps?

It means moving security checks earlier in the software lifecycle, closer to the moment code is written, so problems are found while the developer still has context and fixes are cheap. Examples include secret scanning at commit time and dependency scanning in pull requests.

Does shift left replace penetration testing?

No. Automated checks catch known patterns and vulnerable dependencies. Penetration testing and design review still find logic flaws, chained issues and business-specific risks that scanners miss. Shift left reduces how much a pen test finds; it does not remove the need for one.

Which security check should a team add first?

Server-side secret push protection, followed by dependency scanning in pull requests. Both are high confidence, easy to act on, and catch common, serious problems.

Should security scans block a merge?

Only for high-confidence, fixable findings such as verified secrets or critical vulnerabilities with an available fix. Start new checks in warn mode, tune them, and add an exception process before you make them blocking.

What is the difference between shift left and shift right?

Shift left moves checks earlier, into design, code and build. Shift right means monitoring and testing in production, such as runtime detection and re-scanning deployed images. A mature program does both and feeds production findings back into earlier checks.

Is shift left only for developers?

No. Developers fix findings in their code, but security engineers still own tool tuning, policy, threat modeling and incident response, and platform teams build the checks into shared pipelines.

What frameworks describe shift-left security?

NIST SP 800-218 (SSDF) describes secure development practices at a high level, and SLSA describes supply chain integrity levels for builds and source. OWASP projects provide testing guidance and tools.

References

Interested in learning more?Get a callback from our training advisors.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Angry Angry 0
Sad Sad 0
Wow Wow 0
Mridul I am a passionate technology enthusiast with a strong focus on DevOps, Cloud Computing, and Cybersecurity. Through my blogs at DevOps Training Institute, I aim to simplify complex concepts and share practical insights for learners and professionals. My goal is to empower readers with knowledge, hands-on tips, and industry best practices to stay ahead in the ever-evolving world of DevOps.