SSOGEN / Learn / Shift Left Security: Where Each Check Runs and What It Costs

Learn

Shift Left Security: Where Each Check Runs and What It Costs

Moving each security check to the earliest pipeline stage that can catch its problem, so the author sees the finding while the code is still open, is called shift left security. Checks that need real traffic stay in production.

A conveyor with seven inspection stations, labelled 2 Pre-commit hook, 5 Build and 7 Runtime
Each stage gives earlier feedback than the next, and sees less of the running system.

The name comes from testing. In September 2001, Larry Smith described shift-left testing in Dr. Dobb’s Journal: bring quality assurance into development earlier, instead of waiting for a finished build.

Security borrowed the picture. Draw delivery from left to right, then move each check toward the left end. The opposite direction, shift right, covers what only a live system can answer, such as an attack in progress or a CVE published after release.

Seven places a check can run

Each stage gives earlier feedback than the next, and sees less of the running system.

Seven places a check can run, in pipeline order

Stages 1 to 4: the author waits

Shift left: before release
1. Editor (IDE)you, while typing
2. Pre-commit hookyou, before the commit exists
3. Pushyou, before the code is shared
4. Pull requestthe reviewer, before merge
continues at 5. Build

Stages 5 to 7: the release waits, then users are on it

Shift left: before release
5. Buildthe pipeline, before the artifact is stored
6. Deploythe release, before it goes live
Shift right: in production
7. Runtimeusers are already on it
Only stage 7 sees real traffic.
  • Earlier stages. The fix is small: one line in a file the author still has open, not a revert of a shipped build.
  • Later stages. The check sees more: the built artifact, the full dependency tree, the deployed configuration.
  • Runtime. The only stage where real traffic exists, an attacker’s included.

Which check goes where

NIST SP 800-218 (SSDF) names both types of left check as practices: PW.7 reviews or analyzes human-readable code, and PW.8 tests executable code.

Check and example tool Earliest stage Runs again at Catches Misses
Secret scanning: Gitleaks, GitHub push protection 2 Pre-commit hook 3 Push, then a scan of the repository history API keys, tokens and private keys in a commit Credentials with no fixed format, unless their entropy flags them
Code patterns, with static analysis (SAST): Semgrep, CodeQL 1 Editor 4 Pull request, on the changed lines Untrusted input reaching a SQL query or a shell command; unsafe API calls Flaws that depend on runtime configuration or business logic
Dependencies, with OWASP Dependency-Check 5 Build A nightly run against new CVE data Libraries with a published CVE, with the CVSS score Flaws not yet disclosed; libraries it cannot identify
Container images, with image scanning: Trivy 5 Build, before the registry push The registry, as new CVEs appear Known CVEs in the image’s OS packages and dependencies What the container does once it runs
Infrastructure as code: Checkov, Trivy misconfiguration scan 2 Pre-commit hook or 4 Pull request 6 Deploy, as an admission policy Misconfigurations before deployment, such as a public storage bucket Changes made by hand after deployment (drift)
Running application, with dynamic testing (DAST): ZAP baseline scan 6 Deploy, to staging Each release candidate Missing security headers and other issues visible over HTTP Pages the crawler never reaches; logic flaws
Runtime behavior: Falco 7 Runtime Continuously Abnormal activity on hosts and containers, such as a terminal shell in a container Weaknesses nobody exploits yet

The real cost of a check is the wait

A slow or noisy early check gets bypassed, and a bypassed check catches nothing. The numbers come from each tool’s own documentation.

  • One flag skips every local hook. git commit --no-verify bypasses the pre-commit and commit-msg hooks. A hook that is slow or flags too much teaches people that flag, so keep hooks to fast checks such as secrets and formatting.
  • A hook sees only staged files. The pre-commit framework runs its hooks against the staged files by default, which keeps it fast. A whole-repository scan belongs in CI, where the project documents pre-commit run --all-files.
  • The first dependency scan is slow. Dependency-Check’s first run downloads and processes the NVD data, and the Maven documentation says it may take 20 minutes or more. After that, a run at least every seven days updates in seconds. Cache the data between CI builds.
  • A baseline web scan takes minutes. ZAP’s baseline scan spiders the target for 1 minute by default, waits for passive scanning and sends no attacks. ZAP puts the run at a few minutes at most, which fits a staging deploy.
  • The “100 times” figure is not a study. The ratios often quoted for fixing a defect after release, 60 to 100 times its design cost, cite 1981 IBM course notes. Laurent Bossavit traced that source to an internal IBM training unit, not a research body. The waits above are costs you can measure.

Shift right: what only production can check

Some failures exist only with real traffic, the deployed configuration and CVEs published after release.

  • A left check asks about the code. It looks for a known injection pattern in the diff, a library version with a CVE today, or a Terraform file that fails policy.
  • A right check asks about the running system. Someone may be exploiting the service now. A CVE may appear after the release shipped, or the live configuration may drift from the file.

Right-side controls include a web application firewall, runtime detection such as Falco, canary releases, penetration tests and bug bounty reports. The SSDF assigns this work to practice RV.1, which identifies and confirms vulnerabilities on an ongoing basis.

Shift left, shift right and DevSecOps

What is shift left testing?

Shift-left testing moves testing earlier in the project, so quality assurance works alongside development instead of after it. Shift left security applies the same move to security checks: static analysis in the editor, secret scanning before a push and dependency checks in the build.

What is shift right security?

Shift right security covers the checks that run against the live system after release. Examples are runtime detection, a web application firewall, monitoring for CVEs published after release, canary releases and penetration tests. It complements shift left: a left check tests the code, a right check watches what happens to it in production.

Is shift left the same as DevSecOps?

No. Shift left is about where a check runs; DevSecOps is about who owns security in a team that builds and operates software. DevSecOps teams usually shift checks left, because the developer owns the fix. A team can also place checks earlier without changing its structure, such as a pre-commit hook in one repository.

What vulnerabilities does shift left security catch?

It catches what is visible in code, dependencies, images and configuration before release. Typical findings are leaked API keys, injection-prone code, libraries with a published CVE, vulnerable OS packages in an image and misconfigured infrastructure templates. It misses flaws disclosed after release, logic errors and attacks on the running service; those need shift-right checks.

One repository, in order

Start with the cheapest checks that give the clearest findings, then add the slower ones.

  1. Secrets at pre-commit and push

    Add a Gitleaks pre-commit hook. Switch on GitHub push protection for the repository; it is off by default.

  2. A dependency check in the build

    Set a CVSS threshold. Dependency-Check’s default of 11 never fails a build, because scores stop at 10.

  3. Static analysis on the pull request

    GitHub code scanning shows new alerts on changed lines as annotations, so the review stays about this change.

  4. An image scan before the registry push

    Scan the built image with Trivy before any environment can pull it.

  5. A DAST baseline against staging

    Run the ZAP baseline scan after each staging deploy.

  6. Runtime alerts

    Send Falco alerts from hosts and containers to whoever is on call.

Sources, all read 2026-11-18:

Updated