Shift-left
The further left in the lifecycle a flaw is found, the cheaper it is to fix.
What it is
Draw the software lifecycle from left to right: code, build, test, staging, production. Shift-left means moving security checks as far to the left of that line as possible, from production toward the developer's keyboard.
In practice: the hook that blocks before the commit
The most tangible example is pre-commit: a local hook that runs the same tools as the pipeline, but on the dev's machine, before the code even leaves. The configuration below runs and on every commit:
repos:
- repo: https://github.com/gitleaks/gitleaks
hooks:
- id: gitleaks # blocks the key before the commit
- repo: https://github.com/semgrep/semgrep
hooks:
- id: semgrep
args: ["--config", "auto"] # the same rules as CILayered defense, not replacement
The local hook is fast and cheap, but it is not an authority: you can pass --no-verify and skip it. That is why the same check runs again on the PR and in the build, layers with different costs. Early (IDE, pre-commit) for fast feedback; later (CI) as the real gate that nobody skips.
The economic effect
The cost of a defect grows by orders of magnitude as it moves through the lifecycle: fixing a line in the editor takes seconds; the same problem in production can cost an incident, a leak and users' trust. Shift-left is not about liking security, it is about arithmetic.
The limit of shift-left
Moving checks earlier does not eliminate what comes later: some vulnerabilities only exist in the assembled system, with real configuration and data, which is the territory of and production monitoring. Shift-left complements late checks, it does not replace them.
connections on the map
- Shift-leftanticipatesSAST
- Shift-leftanticipatesSCA
- Shift-leftstarts at designThreat modeling: think like the attacker before coding
updated on 14/10/2026 · sources to go deeper · report an error
Unlocks
test what you learned
Loading questions…