QA & TestingBasic

Shift Left Security

Practice of integrating security testing and controls earlier in the software development lifecycle, instead of leaving them for the end.

Pronunciation

/ʃɪft lɛft sɪˈkjʊərɪti/
"shift left si-KYOOR-i-tee"
Listen on:Forvo

What is it

Shift Left Security means moving security testing and controls earlier in the software development lifecycle (SDLC).

The name comes from visualizing the SDLC as a timeline from left to right: “shift left” = move left = earlier.

Common pronunciation mistakes

  • ❌ “shif lef” (the final ‘t’ in shift and left is pronounced)

The traditional problem

┌─────────────────────────────────────────────────────────┐
│          TRADITIONAL MODEL (Security at the end)        │
├─────────────────────────────────────────────────────────┤
│                                                          │
│   Requirements → Design → Code → Test → QA → SECURITY  │
│                                                    ↑     │
│                                                    │     │
│   "We found 47 critical vulnerabilities.           │     │
│    Launch is delayed 3 months."             ───────┘     │
│                                                          │
│   Cost to fix a defect:                                  │
│   grows the later it is found                            │
│   (design < code < production)                           │
│                                                          │
└─────────────────────────────────────────────────────────┘

The solution: Shift Left

┌─────────────────────────────────────────────────────────┐
│          SHIFT LEFT MODEL (Continuous Security)         │
├─────────────────────────────────────────────────────────┤
│                                                          │
│   Requirements → Design → Code → Test → QA → Deploy    │
│       ↑          ↑         ↑        ↑      ↑            │
│       │          │         │        │      │            │
│   Threat     Security   SAST    DAST   Pentest         │
│   Modeling   Review     SCA     IAST                    │
│                                                          │
│   Security integrated in EVERY phase                    │
│                                                          │
└─────────────────────────────────────────────────────────┘

Tools by phase

Phase Tool What it does
Requirements Threat Modeling Identifies threats early
Design Security Review Reviews architecture
Code SAST (Snyk, SonarQube) Static code analysis
Code SCA (Dependabot) Dependency review
Build Container Scanning Reviews Docker images
Test DAST (OWASP ZAP) Dynamic testing against the running app
Test IAST Instrumented runtime analysis during testing
Pre-release Pentest Manual penetration testing

Practical example: Pipeline with Shift Left

Security tip: never reference branches like @master; pin third-party actions to a version and, in production, to a full commit SHA. Tags can move too: in March 2026, an attacker force-pushed 76 of the 77 version tags of aquasecurity/trivy-action to credential-stealing malware (Trivy security advisory). The examples below use tags for readability.

# .github/workflows/secure-pipeline.yml
name: Secure CI/CD

on: [push, pull_request]

jobs:
  # 1. SAST - Static analysis (very early)
  sast:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

      - name: Run SAST
        uses: snyk/actions/node@v1.0.0
        env:
          SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
        with:
          command: code test   # Snyk Code = SAST
          args: --severity-threshold=high

  # 2. SCA - Dependency analysis
  dependency-check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

      - name: Check for vulnerabilities
        run: npm audit --audit-level=high

      - name: Snyk dependency scan
        uses: snyk/actions/node@v1.0.0
        env:
          SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
        with:
          command: test        # Snyk Open Source = SCA

  # 3. Secrets scanning
  secrets:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

      - name: Scan for secrets
        uses: trufflesecurity/trufflehog@v3.97.4
        with:
          path: ./

  # 4. Container scanning
  container-scan:
    runs-on: ubuntu-latest
    needs: [sast, dependency-check]
    steps:
      - uses: actions/checkout@v6

      - name: Build image
        run: docker build -t myapp:${{ github.sha }} .

      - name: Scan container
        uses: aquasecurity/trivy-action@v0.36.0
        with:
          image-ref: myapp:${{ github.sha }}
          severity: HIGH,CRITICAL

  # 5. DAST - Only if everything above passed
  dast:
    runs-on: ubuntu-latest
    needs: [container-scan]
    steps:
      - name: OWASP ZAP Scan
        uses: zaproxy/action-full-scan@v0.13.0
        with:
          target: 'https://staging.myapp.com'

Benefits of Shift Left

Metric Without Shift Left With Shift Left
Cost per defect High (found in production) Lower (found in development)
Fix time Days/Weeks Hours
Vulnerabilities in prod Many Few
Release time Unpredictable Predictable
Team confidence Low High

Practical case: Before vs After

Before (Security at the end)

Monday: Developer finishes feature
Tuesday-Thursday: QA tests functionality
Friday: Security team reviews
        → Finds SQL Injection
Next week: Developer fixes
        → Another QA cycle
        → Release delayed 2 weeks

After (Shift Left)

Monday: Developer writes code
        → IDE shows SAST warning: possible SQL Injection
        → Developer fixes on the spot (5 min)
        → Push to repo
        → Pipeline runs SAST, SCA, container scan
        → All green ✅
Tuesday: QA tests, security already validated
Wednesday: Release on time

Gradual implementation

Phase 1: Quick wins (Week 1-2)

# Add to your existing pipeline
- name: Dependency audit
  run: npm audit --audit-level=high

- name: Secret scan
  uses: trufflesecurity/trufflehog@v3.97.4

Phase 2: SAST (Week 3-4)

- name: SAST scan
  uses: snyk/actions/node@v1.0.0
  # Only fail on critical at first
  with:
    args: --severity-threshold=critical

Phase 3: Container Security (Month 2)

- name: Container scan
  uses: aquasecurity/trivy-action@v0.36.0

Phase 4: DAST (Month 3)

- name: DAST scan
  uses: zaproxy/action-full-scan@v0.13.0
Category Open Source Commercial
SAST Semgrep, Bandit Snyk, SonarQube (has a free edition)
SCA OWASP Dependency-Check Snyk, Mend (formerly WhiteSource)
Secrets TruffleHog, git-secrets GitGuardian
Container Trivy, Clair Aqua, Prisma Cloud
DAST OWASP ZAP Burp Suite, Acunetix

Metrics to measure success

Goals are indicative examples; adjust them to your context and risk level.

Metric What it measures Example goal
MTTR Mean time to remediation < 24 hours
Escaped vulnerabilities Bugs that reach prod 0 critical
Scan coverage % of code/deps scanned > 90%
Pipeline time CI/CD duration < 15 min
  • CI/CD - Pipeline where security is integrated
  • DevSecOps - Security culture in DevOps
  • SAST - Static Application Security Testing
  • DAST - Dynamic Application Security Testing

Remember: Shift Left doesn’t mean eliminating security tests at the end—it means adding security at every phase. The earlier you detect a problem, the cheaper and easier it is to fix.