// module 04 · A central security gate
Diff-aware SAST with a baseline
Add Semgrep to the central gate so it blocks only what a pull request adds. The gate checks out full history, finds the merge base, and runs a digest-pinned Semgrep with `--baseline-commit`, using four rules the security team owns instead of a large registry pack. A PR that adds a new `exec()` with request data fails; the old `exec()` already in every repo doesn't block anyone.
Learning Objectives
- Run Semgrep so that only findings new since the merge base fail a pull request
- Pin the scanner and the rules, so the gate's verdict changes only when you change it
- Compare a registry ruleset with a small curated one on real code, by findings and by noise
- Load a reusable workflow's own files at the commit the caller pinned
- Explain which old findings a baseline hides and when they come back
This lesson is for enrolled learners
Log in, then enroll to read the full lesson, run its lab and take the quiz.
