Module 11 · Project 11 · Add Security to the Pipeline (DevSecOps) · Lesson 37 of 48
Shift left: security gates in CI
Why security checks belong in the pipeline, what each kind of scanner catches, and how to set thresholds the team will actually respect.
In this lesson · about 30 minutes
- Explain shift-left security and why it's cheaper
- Match secret scanning, SAST, SCA, IaC scanning, image scanning and DAST to the problems they catch
- Choose a severity threshold and handle false positives
Security as part of every change
The old way: build for months, then hand it to a security team for a review just before launch. They find 40 problems, launch slips, and everyone resents everyone. DevSecOps moves security into the pipeline, so every pull request is checked automatically within minutes, while the developer still remembers the code.
That's shift left: move checks earlier (to the left on a timeline). A problem found in the editor costs minutes to fix. In CI, an hour. In production, maybe a breach, an incident and a public apology.
The scanners
- Secret scanning (Gitleaks, GitHub secret scanning, TruffleHog): API keys, passwords and tokens committed by mistake. Run it as a pre-commit hook and in CI. If a real key leaks, revoke it first: removing the commit isn't enough, because clones and forks already have it.
- SAST, static application security testing (Semgrep, CodeQL, SonarQube): reads your source code for dangerous patterns such as SQL built from user input, unsafe deserialization or missing checks.
- SCA, software composition analysis (npm audit, pip-audit, Trivy, Dependabot, Snyk): checks your dependencies against databases of known vulnerabilities (CVEs). Most of your app's code is other people's code.
- IaC scanning (Checkov, tfsec/Trivy config, kube-linter): Terraform and Kubernetes YAML that's insecure, like public S3 buckets, open security groups, or containers running as root.
- Container image scanning (Trivy, Grype): vulnerable OS packages in the base image, plus your app's packages.
- DAST, dynamic testing (OWASP ZAP): attacks the running app on staging from the outside, finding issues such as missing security headers, injection and misconfigured cookies.
To understand the attacks these tools look for, see the Ethical Hacking Fundamentals course. For the wider security picture, see CompTIA Security+.
Thresholds and false positives
- Scanners report a severity: critical, high, medium, low. Decide which ones fail the build. A common start: block on critical and high, report the rest.
- Only block on things that can be fixed: many scanners can ignore CVEs with no fix available yet (
--ignore-unfixed). - When a finding is a false positive or an accepted risk, record it in an ignore file with a reason and an expiry date, reviewed in a PR. Never just turn the scanner off.
- Start new scanners in report-only mode, fix the backlog, then switch to blocking. Otherwise day one fails every build and the team learns to hate security.
Try it · watch it run
DevSecOps: security gates in the pipeline
Put different problems into the code, choose what should fail the build, and push. Watch which gate catches each problem and where the pipeline stops. Try the same problems with each threshold.
Put problems in the code
1. Secret scan
Gitleaks
2. SAST
Semgrep
3. Dependencies
npm audit / Trivy fs
4. IaC scan
Checkov
5. Build + image scan
Trivy image
6. DAST on staging
OWASP ZAP
Push to run the pipeline.
Sorting drill
Which scanner catches it?
Match each problem to the scanner that finds it first.
- A Stripe API key in a test file
- User input concatenated into an SQL string
- A logging library with a critical CVE
- Security group open to 0.0.0.0/0 on port 22
- OpenSSL in the base image has a high CVE
- Session cookie missing the Secure flag on staging
- Kubernetes Deployment running as root with no limits
0 of 7 sorted
Whiteboard · watch and try
Where each gate sits
Press Play. The tutor places each check on the pipeline.
Tip: press Pause, then use the pen to work along on the board. Space plays and pauses; Ctrl+Z undoes your last mark.
Check your understanding0 of 3 correct
Key terms
Say the meaning to yourself, then tap a card to check.
Quiz score: 0 of 3
Written by Noviq Academy in its own words. The labs are simulations: no real servers are touched. When you build the projects yourself, use a practice virtual machine or a free-tier cloud account you control, watch your cloud spending, and never run cleanup or delete commands on a machine you care about. Tool names belong to their owners; versions and output are shown for learning and may differ slightly from yours. Read-aloud and the whiteboard voice use your device's built-in voices.