Articles / Integrating Security Scanning Into CI/CD Gates
AppSec · Pipeline Security

Integrating Security Scanning Into CI/CD Gates

Automating a security scan is easy. Deciding what it should be allowed to stop is the hard part. Set the gate too loose and findings pile up in a report nobody reads; set it too tight and you become the reason releases are late, which is a reputation that gets your gate removed. A CI/CD security gate is a policy decision wearing a YAML costume, and getting the policy right matters far more than the tool you pick.

A security gate is a pipeline step that can fail the build — and failing the build is a strong action with real cost. The design question is not “can we scan here?” but “which findings are confident and severe enough to justify blocking a merge or a deploy, and which should be recorded without stopping anyone?” Answer that badly in either direction and the gate stops doing its job.

Where each check belongs

passfail → block mergePull requestSAST + secretsBuildSCA + SBOMGatenew + high-sev?DeployPost-deployDAST + monitorGate the wholebacklog → everyone'senemy; too loose →ignored
Security checks by stage — gate on the delta, not the backlog.
  • Pull request: diff-aware SAST and a hard secrets gate. Fast, scoped to the change, commenting inline where the developer already is.
  • Build: SCA against the resolved dependency tree and an SBOM generated from the actual artefact — the one moment you know exactly what shipped.
  • Pre-deploy: container and infrastructure-as-code scanning, plus policy checks on the image about to go out.
  • Post-deploy: DAST against staging and continuous monitoring of standing SBOMs as new advisories land.
Why it matters: Blocking on the entire backlog of pre-existing findings makes the gate everyone's enemy on day one. Gate on what the change introduces; burn down the legacy findings on a separate track.

Gate on the delta, and on severity

Two principles keep a gate both effective and tolerable. First, baseline the existing state and fail only on newly introduced findings — developers are accountable for their own diff, not for history. Second, gate on severity and confidence, not raw count: a confirmed live secret or a high-confidence injection blocks; a low-severity, low-confidence advisory is logged. A single break-glass path, audited and time-boxed, lets a genuine emergency ship without teaching everyone to disable the check.

A policy that blocks the right thingsfail_on:
  - severity: [critical, high]
    introduced_in: diff # not the backlog
  - category: secret
    verified: true # live credential — always block

Speak the pipeline's language

Findings should flow as data, not screenshots. SARIF — the Static Analysis Results Interchange Format — is the common output that lets any scanner's results render as inline annotations in code review and aggregate in one dashboard regardless of which tools produced them. Standardising on it means you can swap or add scanners without rebuilding your reporting, and developers see every tool's findings in one consistent place.

Keep it fast, keep it green for the right reasons

A gate that adds ten minutes to every pipeline run trains teams to resent it. Cache dependency and analysis data between runs, parallelise scans with the rest of CI rather than serialising them, and scope work to the change. Just as important, keep the gate trustworthy: if it fails builds on noise, engineers will lobby to remove it, and a disabled gate protects nothing. A green pipeline should mean the change is clean, and a red one should mean something real.

The gate is where discovery becomes enforcement — the point at which knowing about a class of flaw finally prevents it from shipping. Tune it so that passing is meaningful and failing is rare but respected, and it becomes the quiet backstop that keeps known-bad code from ever reaching production.

Test for it — in practice
  • Look at what your CI gate actually fails on: the delta and high-confidence, high-severity findings, or the entire pre-existing backlog (which makes it everyone's enemy on day one)?
  • Check whether findings flow as SARIF into code review, or land as a report no one opens.

Reviewing one gate policy is quick; designing gates that block the right findings at the right stage across every pipeline is what our assessment runs for you.

Keep reading
From Finding to Fix: Remediation Workflows That Stick