CI/CD Security Gates: When to Break the Build (and When Not To)
Every security team that adds scanners to a pipeline hits the same moment. The first time a build fails because of a security finding, a developer asks a fair question: "Is this actually dangerous, or is the tool just noisy?" If the answer is "noisy" too many times, the gate gets switched to warning-only, or someone quietly adds a skip flag, and security loses the one control that acted before code reached production.
A security gate is only useful if people trust it. This guide explains what a CI/CD security gate is, why "fail on every high" backfires, which findings deserve to stop a build, and how to roll out gates without turning the pipeline into a battlefield.
What a security gate is
A quality gate is a rule in the pipeline that passes or fails a build based on the results of automated checks. Rapid7 describes it as a control DevOps teams create to halt or fail a build when a threshold of issues is detected (Rapid7). A security gate applies the same idea to the findings of your security tools:
- SAST on the code you write.
- SCA on open source dependencies and container images.
- Secret scanning on commits.
- IaC scanning on Terraform, CloudFormation, Kubernetes manifests and similar files.
- DAST against a running build in a test environment.
The OWASP Developer Guide lists these same families of testing as the building blocks of a DevSecOps pipeline (OWASP). The tools are the easy part. The hard part is the policy: which result is allowed to stop a release.
What the standards actually ask for
NIST's Secure Software Development Framework (SSDF, SP 800-218 v1.1) does not tell you to fail builds on a given score. It asks you to define criteria for software security checks and track them throughout the lifecycle (practice PO.4), to use automation in the toolchain (PO.3), to review and analyze code (PW.7), to test executable code (PW.8), and to identify and confirm vulnerabilities on an ongoing basis (RV.1). One of its examples mentions verifying compliance at key points of the lifecycle with gates (NIST SP 800-218).
Two details in the SSDF matter for gates. First, it does not prescribe how to implement each practice: the thresholds are your decision. Second, among the examples for PO.4 it suggests automating decisions based on the criteria and periodically reviewing those processes. A gate is a policy you maintain, not a setting you configure once.
Why "fail on every high" backfires
The most common first gate is a count or severity threshold: fail the build if there is any critical, or more than five highs. It looks objective. In practice it fails for three reasons.
1. It punishes the wrong person
A count threshold looks at the whole repository. A developer who changes one line of CSS inherits the forty findings that were already there and gets a red build. The gate does not change their behavior; it only teaches them to resent it.
2. Severity is not risk
CVSS describes how bad a vulnerability could be in general. It does not know whether the vulnerable function is reachable from your code, whether the service is exposed to the internet, or whether anyone is exploiting it. A high-severity finding in a test dependency and the same finding in an internet-facing login service get the same red light. We covered why this matters in EPSS vs CVSS and SCA reachability analysis.
3. False positives become blockers
Static analysis tools report patterns, and some of those patterns are safe in context. If an unconfirmed SAST finding can block a release, every false positive becomes an incident for the development team. See how to triage SAST false positives for the other side of this problem.
What should stop a build
A useful rule of thumb: break the build only for findings that are new, confirmed and dangerous. Everything else goes to the backlog with an owner and a deadline.
Block
- Verified secrets. A live API key, token or private key in a commit. This is the clearest case: the fix is cheap now and expensive later. If one slips through, follow a leaked secret response playbook.
- Dependencies with known exploitation. A component with a vulnerability listed in CISA's KEV catalog, especially if your code reaches the vulnerable function.
- New high-confidence findings in changed code. A SQL injection or command injection introduced by this pull request, with a confident rule.
- Infrastructure that opens the door. IaC that makes storage public or exposes admin ports to the whole internet.
Warn (do not block)
- New medium-severity findings, or findings with low confidence.
- Dependency vulnerabilities with no known exploitation and no evidence the code is reachable.
Send to the backlog
- Existing findings that were already in the code before this change. Record them as a baseline and work them through your normal remediation process with SLAs.
- Low-severity issues and hygiene items.
Four design rules for gates people trust
1. Make the gate diff-aware
Compare against a baseline and evaluate only what this change introduces. Most modern scanners support baselines or "new code" policies. This single change removes most of the frustration.
2. Gate on risk, not just severity
Combine signals: severity, confidence of the rule, reachability, exploitation evidence (KEV, EPSS, public exploit), exposure of the service and criticality of the asset. A medium finding in an internet-facing payment service can deserve more attention than a critical in an internal batch job.
3. Every exception expires
There will be emergencies. Provide a documented override: who can approve it, why, and until when. An override without an expiry date is just a permanent hole. Track exceptions like any other risk acceptance.
4. Start in audit mode and measure
Run new rules in warning mode for a few weeks before they can block. Then measure the gate itself:
- Block rate: what share of builds it stops.
- Override rate: how often people skip it. A high rate means the policy is wrong, not the people.
- False positive rate of blocking rules.
- Time to fix blocked findings.
If a rule blocks often and is overridden often, demote it to warning and tune it. If a rule never blocks, check that it is running.
How to roll it out in 30 days
- Week 1: inventory the scanners already in your pipelines and turn on secret scanning in blocking mode for verified secrets.
- Week 2: record a baseline of existing findings in every repository and make the gates diff-aware.
- Week 3: run SAST, SCA and IaC rules in audit mode. Review what would have been blocked with the development leads.
- Week 4: promote the rules with high confidence and low noise to blocking. Publish the policy and the exception process.
FAQ
Should we fail on CVSS 7 or above? Not on its own. Use severity as one input and add exploitation evidence, reachability and exposure. Otherwise you will block on findings that do not matter and miss the medium that does.
What about urgent hotfixes? Keep a break-glass path with named approvers and an automatic ticket. The fix still has to happen, just after the release.
Who owns the gate policy? Security defines the criteria, development leads agree on them, and both review the metrics every quarter, as the SSDF suggests.
How priorIQ.ai helps
CodeIQ brings SAST, SCA, secrets, containers and IaC into one view, uses AI to triage each finding, and goes from the commit to a pull request with the proposed fix. That makes it easier to keep blocking rules for what really matters. Its findings join the same risk model as endpoints and cloud in PriorIQ Core, so the backlog that does not block the build is still worked as a single prioritized queue, and OnGuardIQ tracks exploits and PoCs for the CVEs in your environment. Request a demo.