Use build blocking for high-confidence findings that map to clear security risk and require immediate remediation. Use alerting when the pattern is security-relevant but needs human context before action. The right split depends on signal quality, business impact, and how consistently developers can fix the underlying code without creating unnecessary disruption.
Why teams draw the line between blocking and alerting
The decision is really about enforcement confidence and blast radius. Build blocking makes sense when a Semgrep rule is precise enough that developers can trust it and the finding points to a defect that would materially change exposure if it reached production. Alerting is better when the pattern is informative but still noisy, context-dependent, or too broad to justify stopping delivery every time.
The practical question is not whether the code is “bad,” but whether the organisation can consistently treat the finding as an actionable control failure. Teams usually block when a rule corresponds to a well-understood unsafe pattern, a clear policy violation, or a high-severity issue that is cheap to fix early. They alert when the same pattern needs review against business logic, environment, compensating controls, or rollout timing. In practice, many security teams learn this after a noisy rule trains developers to ignore the scanner entirely.
How Semgrep fits into the delivery workflow
Semgrep works best when its rules are mapped to the maturity of the engineering process, not just the technical severity of the issue. A build-breaking rule should represent something the team has decided is unacceptable to merge, such as a known unsafe API use, a forbidden secret-handling pattern, or a code path that repeatedly creates serious security defects. An alerting rule should capture useful security signal that improves review quality without forcing an immediate stop.
Good teams usually separate findings into three operational buckets:
-
Block: high-confidence, high-impact, low-ambiguity findings with a clear remediation path.
-
Alert: security-relevant findings that need human judgment, environment context, or exception handling.
-
Tune: rules that are too broad, too noisy, or too dependent on framework-specific code patterns to enforce automatically.
This split also depends on where the scanner runs. A pre-merge check can tolerate stricter enforcement than a broad repository scan because developers can fix code before it spreads. Conversely, a rule that is safe to alert on in a mature codebase may need to become blocking once the team has evidence that it catches repeatable, high-risk mistakes. The best source of truth is the pattern’s false-positive rate plus the team’s actual remediation behaviour, not the rule author’s intent alone. SLSA is useful here because it frames delivery controls around build integrity and provenance, which helps teams decide which issues belong in the gate versus the queue.
These controls tend to break down when rules are inherited across very different services without local tuning, because the same pattern can be critical in one codebase and merely informational in another.
Common variations and edge cases
Tighter enforcement often increases developer friction, so teams have to balance security confidence against delivery speed. That tradeoff becomes sharper when the scanner is used across multiple languages, frameworks, or levels of code maturity.
One common edge case is a rule that is technically correct but not yet stable enough to block. Early in rollout, alerting lets teams measure noise, refine metadata, and confirm that remediation guidance is clear before they turn the rule into a hard gate. Another is environment sensitivity: a finding may be acceptable in a test-only path but unacceptable if the same code can reach production credentials, external APIs, or customer data.
There is also a difference between security severity and operational urgency. Some findings merit blocking because they are straightforward indicators of a dangerous practice; others should trigger review because the right response is not uniform. Current guidance suggests teams should avoid making every meaningful rule blocking, because overuse of hard gates can create exception fatigue and encourage developers to route around the tool instead of fixing the underlying issue. When in doubt, the safest default is to alert first, then promote a rule to blocking after it proves precise, stable, and consistently fixable.
Risk and Threat Considerations
Misclassifying a finding creates two different risks: false negatives when dangerous code is allowed to merge, and false positives when developers learn that the scanner is easy to ignore. The security impact is not limited to code quality, it affects whether the build pipeline is trusted as a control.
Failure mechanism: Weak rules, broad patterns, or inconsistent exception handling let risky code pass through as “just another alert,” while overly aggressive gates generate noise that trains teams to bypass the scanner or defer fixes indefinitely.
Impact: Security defects can ship into production, remediation backlog grows, and the organisation loses confidence in the build as a meaningful enforcement point.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
CIS Controls v8 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| CIS Controls v8 | CIS 16 — Application Software Security | Semgrep rules enforce secure code patterns in delivery pipelines. |
| Recommendation — Use CIS 16 to gate merges on high-confidence insecure code patterns. | ||
| NIST CSF 2.0 | PR.DS-1 — Data-at-rest protection | Semgrep findings often flag code paths that expose sensitive data handling. |
| PR.IP-1 — Baseline configuration management | Teams must tune scanner rules and enforcement thresholds consistently. | |
| Recommendation — Apply PR.DS-1 to block code paths that mishandle sensitive data. Use PR.IP-1 to standardise rule tuning and enforcement criteria. | ||
Practitioner Guidance
What to prioritise: Start by classifying rules by confidence, blast radius, and remediation repeatability. If the issue is both high-confidence and consistently fixable, promote it to a blocking control; if it still needs review for business context, keep it as an alert until the signal stabilises.
What to verify: Validate the rule against real repositories, not just a sample snippet. A rule is ready to block only when the false-positive rate is low enough that engineers trust the gate and security can explain every enforced failure in plain terms.
Decision rule: If a developer can safely resolve the finding without changing intended behaviour, blocking is usually appropriate. If remediation depends on design intent, deployment context, or exception approval, alerting is the better default.
Practitioner takeaway: The right split is less about the scanner and more about whether the organisation is ready to turn a finding into an enforceable policy without creating noise that weakens the control.
Related resources from NHI Mgmt Group
- How do teams decide when to block a loyalty account versus investigate first?
- How should security teams decide what to build versus buy in an AI SOC?
- How do teams decide when to block a pipeline versus continue in fail-forward mode?
- How do security teams decide when to block API activity versus just monitor it?