पाठ 2 / 31
Shift Left (and Shield Right)
यह पाठ अभी हिंदी में अनुवादित नहीं है, इसलिए अंग्रेज़ी में दिखाया जा रहा है।
Describe what shifting security left means, why early fixes are cheaper, and why production monitoring is still needed.
लेखक: Rahul Agarwal · 15 साल से वेब डेवलपर
Why earlier is cheaper
Draw the software lifecycle as a line from left to right: plan, code, build, test, release, deploy, operate. Shifting left means moving security checks towards the start of that line. A SQL injection caught by a linter in the editor costs a minute to fix. The same bug found in a penetration test costs a ticket, a context switch for a developer who has forgotten the code, a re-test and maybe a delayed release. Found by an attacker in production, it costs an incident, customer notifications and reputation. Early feedback is also better feedback: it arrives while the author still remembers why the code looks the way it does. But shifting left does not mean everything can be caught early. Misconfigurations, new CVEs in old dependencies and abuse patterns only show up later, so mature teams also shield right: runtime monitoring, alerting and fast patching in production.
The secure delivery loop
Security activities attach to every stage of delivery: you plan with a threat model, code with linters and secret scanning, build with SAST and dependency checks, deploy with signed artefacts and policy checks, and operate with monitoring that feeds lessons back into planning.
Catching problems before they leave your laptop
A .pre-commit-config.yaml runs checks on every git commit, the leftmost automated point in the lifecycle. Install it once with pre-commit install.
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: detect-private-key # blocks committed PEM keys
- id: check-added-large-files
- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.4 # pin a released tag
hooks:
- id: gitleaks # scans staged changes for secretsFast feedback or no feedback
Checks that run on every commit must finish in seconds. Put slow scans (full DAST, deep SAST) in nightly or pre-release jobs; a slow pre-commit hook is quickly bypassed with --no-verify.
त्वरित जाँच: Why do teams still invest in production monitoring after shifting security left?
- Because shift-left tools are illegal in production
- Because early checks make monitoring unnecessary
- Because some issues, such as new CVEs or misconfigurations, only appear after release
- Because monitoring replaces code review
Answer
Because some issues, such as new CVEs or misconfigurations, only appear after release — Early checks catch many defects, but new vulnerabilities and runtime misconfigurations surface later, so you also need to shield right.