Shift-left means finding problems in the pipeline instead of production. Done badly it is a wall of red that developers learn to ignore. Done well, it fails only on risk that is both real and fixable.
Four scanners, one pipeline
security:
stage: test
script:
- trivy fs --scanners vuln,secret,misconfig --severity HIGH,CRITICAL --ignore-unfixed --exit-code 1 .
- trivy config --severity HIGH,CRITICAL --exit-code 1 . # IaC misconfig
- sonar-scanner -Dsonar.qualitygate.wait=true # SAST + quality gateTuning the gate
- Gate on HIGH/CRITICAL and ignore-unfixed at first, then tighten
- Fail on new issues in changed code, not the whole legacy backlog
- Generate an SBOM so you can answer 'are we affected?' fast
# produce an SBOM for supply-chain visibility
trivy image --format cyclonedx -o sbom.json ghcr.io/acme/web:latestA security gate that always screams gets muted. One that fires rarely and correctly gets respected.
Make the first gate narrow and trustworthy. Once developers trust it, ratcheting the bar upward is easy.