Shift Left

Shift left = move activities earlier in the delivery lifecycle (design → develop → test → staging → prod) so issues are caught cheaper and faster.

Traditional:
 Design ──▶ Develop ──▶ Test ──▶ Staging ──▶ Prod
                              ▲
                         Bugs found here (expensive)

Shift Left:
  Design ──▶ Develop ──▶ Test ──▶ Staging ──▶ Prod
           ▲        ▲
 Bugs found here (cheap to fix)

Cost of fixing a bug by phase:

Design ──────────────────────────── 1x
Code ───────────────────────────10x
Test ─────────────────────────── 100x
Staging ─────────────────────────── 1000x
Prod    ─────────────────────────── 10000x

What Gets Shifted Left

Security — DevSecOps

Without Shift LeftWith Shift Left
Pen test in stagingSAST/DAST in CI
Security review before releaseThreat modeling in design phase
Manual security auditAutomated CVE scanning
Secrets in prodVault + secret scanning in PR
# GitHub Actions — SAST in CI
- name: Run Semgrep
  uses: returntocorp/semgrep-action@v1
  with:
    config: >
      p/owasp-top-ten
      p/nodejs

Testing — TDD / E2E Earlier

Without Shift LeftWith Shift Left
E2E tests only in stagingUnit + integration in dev
Manual QA gateAutomated QA in PR
Performance test at releaseLoad testing in CI
Accessibility ignoreda11y checks in CI

Observability — Design-Time

Without Shift LeftWith Shift Left
Logs added after bugsStructured logging in design
Dashboards built post-launchSLOs defined in design phase
Alerting is reactiveProactive alerts from SLO definitions

Implementation Patterns

1. Pre-commit Hooks

#!/bin/bash
# .git/hooks/pre-commit
semgrep --config p/security-experimental .
pytest tests/unit --fail-fast

2. PR Gates

PR opened
 ├── lint + format check
  ├── unit tests (coverage gate)
  ├── security scan (SAST)
  ├── dependency scan (CVE check)
  ├── secret scan (nocreds)
  └── preview environment deploy
       └── e2e tests against preview
            └── approval gate

3. Architecture Decision Records (ADRs)

ADRs shift design decisions left — record the why, not just the what.

# ADR-001: Use PostgreSQL instead of MongoDB
 
## Status: Accepted
## Date: 2025-05-24
 
## Context
Need a relational store for order items with ACID transactions.
 
## Decision
PostgreSQL 16 with psycopg3.
 
## Consequences
- ✅ ACID compliance for order processing
- ✅ Schema enforcement reduces bugs
- ❌ Need migration strategy for schema changes

Shift Left in Your Stack

Given your setup (Wazuh SIEM, AWS org, n8n), shift-left for security means:

Design ──▶ IaC Scan ──▶ Container Scan ──▶ Wazuh FIM ──▶ SIEM
         (checkov)    (trivy)           (in-prod)     (alerting)
PhaseToolWhat It Catches
IaC (Terraform)checkovOpenSecurity S3, IAM misconfigs
Container buildtrivyCVE in base images
K8s deploykyvernoPolicy violations before apply
RuntimeWazuh FIMFile integrity changes
RuntimeGuardDutyAWS API anomaly detection

Common Pitfalls

PitfallWhy It’s a ProblemFix
Shift everything leftSlows down dev, team ignores gatesShift high-value, high-signal items only
No owner for security in designSecurity is an afterthoughtAdd security review to design checklist
Gates without actionScan runs, nobody caresMake gates blocking for critical issues
No feedback loopSame bugs keep slipping throughTrack bug origin → fix the gate

Quick Reference

Shift Left = catch issues early = cheaper to fix

ActivityTraditional PhaseShifted Phase
Security reviewPre-releaseDesign
SASTStagingCI (PR)
Load testingPre-releaseCI
AccessibilityStagingCI
Chaos engineeringProdStaging
SLO definitionPost-launchDesign

Source