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 the policy 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 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

Integrating Security Scanning Into CI/CD GatesDiagram with these labels, in reading order: what to block?; pass; fail → block merge; Pull request; SAST + secrets; Build; SCA + SBOM; Gate; new + high-sev?; Deploy; Post-deploy; DAST + monitor; Gate the whole; backlog → everyone's; enemy; too loose →; ignored.what to block?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 and leave the backlog to a separate track.
  • 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 artifact, 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 instead of 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 # new findings only, not the backlog
  - category: secret
    verified: true # live credential, always block

Speak the pipeline's language

Findings should flow as data, and screenshots do not count. 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. Standardizing 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 teaches teams to resent it. Cache dependency and analysis data between runs, parallelize scans with the rest of CI rather than serialising them, and scope work to the change. Keep the gate trustworthy too: 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 a finding worth fixing.

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

Back to the knowledge baseRequest an assessment