Shift-left security means integrating security practices as early as possible in the software development lifecycle (SDLC), rather than treating security as an afterthought.
Step 1 — Automated Scanning Pipeline
Integrate Static Application Security Testing (SAST) and Dependency Scanning directly into your pull requests to block vulnerable code from being merged.
github-actions.ymlyaml
name: Security Scan
on: [push, pull_request]
jobs:
trivy-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: 'my-app:latest'
format: 'table'
exit-code: '1'
ignore-unfixed: true
severity: 'CRITICAL,HIGH'Step 2 — Software Bill of Materials (SBOM)
An SBOM is an exhaustive list of all components, libraries, and dependencies involved in building software. It's crucial for identifying vulnerability exposure when new CVEs (like Log4j) are announced.
DevSecOps Pillars
- SAST: Scans source code for logical flaws.
- DAST: Scans running applications for runtime vulnerabilities.
- Container Scanning: Analyzes Docker images for outdated/vulnerable OS packages.