Cloud & DevOps

Automating DevSecOps: Integrating Vulnerability Scanning into CI/CD

Automating DevSecOps: Integrating Vulnerability Scanning into CI/CD

A working DevSecOps pipeline runs fast checks early on every change, slower checks on merge, and gates only on severity thresholds that the team can actually remediate. Findings need an owner and a remediation deadline, otherwise scanning becomes noise that teams learn to ignore.

Layering checks by speed

Pipeline security works when feedback is fast. Secret scanning and dependency checking complete in seconds and should run on every commit, including in pre-commit hooks where possible. Static analysis belongs on push and takes seconds to a few minutes.

Slower checks, such as container image scanning, dynamic testing against a running environment and infrastructure policy evaluation, belong on merge or on a nightly schedule. Running them on every commit slows feedback without changing outcomes.

Dynamic testing needs a deployed environment, so it fits naturally in a staging deployment stage. Infrastructure policy checks belong wherever infrastructure plans are produced, so that a non-compliant plan is blocked before it is applied.

  • Secrets and dependencies: every commit, sub-second feedback.
  • Static analysis and licence checks: every push.
  • Image and infrastructure scanning: every merge or build.
  • Dynamic testing: on staging deployment, nightly if slow.

Gating and triage without stalling delivery

The failure mode of pipeline security is a gate that blocks on findings the team cannot fix, followed by an exemption list that grows until the gate is meaningless. Gate on high severity in code you control, and treat transitive dependency findings as tracked rather than blocking unless an exploit exists.

Triage is the real work. Each finding needs a severity assessment in your context, an owner, a decision of fix, mitigate or accept, and a deadline. Automatic severity from a scanner is an input, not a decision.

Route findings into the existing backlog rather than a separate security tool, so they compete for capacity honestly and are visible to delivery managers who control priorities.

Scan type, cadence and typical gating policy
Scan Cadence Gate
Secret scanningEvery commitBlock immediately
Dependency scanningEvery commitBlock on critical with known exploit
Static analysisEvery pushBlock on high in first-party code
Licence complianceEvery buildBlock on unapproved licence
Container image scanningEvery buildBlock on critical base image issues
Dynamic testingStaging deployReport, block on high
Infrastructure policyEvery planBlock on policy violation

Software supply chain integrity

Modern delivery depends on a large tree of third-party components and build tools, so the pipeline itself is an attack surface. Pin dependency versions with a lockfile, verify checksums, and generate a software bill of materials for every release so that a newly disclosed vulnerability can be answered with a query rather than an investigation.

Sign build artefacts and require signed images at deployment, so only artefacts produced by your pipeline can run. Keep build credentials short-lived and scoped to the pipeline identity rather than stored as long-lived repository secrets.

Protect the pipeline from untrusted pull requests. Workflows triggered by fork contributions should not receive secrets, and any job that does should require an approved environment.

  • Pin dependencies and verify checksums.
  • Generate an SBOM per release and keep it queryable.
  • Sign artefacts and require signatures at deploy time.
  • Withhold secrets from untrusted pull request workflows.

Measuring whether it works

Track four numbers: mean time to remediate by severity, the proportion of findings that are ever fixed, the number of standing exemptions, and the pipeline's added wall-clock time. If mean time to remediate is rising or exemptions are growing, the programme is regressing regardless of how many findings are detected.

Report these to the same audience that reviews delivery metrics, because security throughput is a delivery property, not a separate concern.

Feed the output back into design. Recurring finding classes indicate a missing framework default, which is cheaper to fix once centrally than to remediate repeatedly.

  • Track mean time to remediate by severity.
  • Watch the standing exemption count as a health signal.
  • Measure pipeline time added by scanning.
  • Fix recurring finding classes centrally in framework defaults.

Frequently asked questions

Which security scans should run on every commit?

Secret scanning and dependency scanning, because they complete in seconds and catch the highest-impact issues. Slower checks such as dynamic testing belong on merge or nightly schedules.

Should the pipeline block on any vulnerability?

No. Gate on critical and high severity findings in code you control, and track transitive findings unless a known exploit exists. Gates that block on unfixable findings are eventually disabled by the teams they obstruct.

What is an SBOM and why does it matter?

A software bill of materials lists the components in a release. It lets you answer whether a newly disclosed vulnerability affects you with a query rather than a multi-day investigation, and enterprise customers increasingly require it.

References

Related engineering guides

Engineer your next strategic platform

Estimate your project investment and delivery timeline instantly, or schedule an architectural discovery call with our engineering leadership.

Launch Cost Estimator Speak with an Architect