Someone from the security team has asked you to "shift left". What arrived was a ticket, a vendor trial licence, and a deadline. You bolt the scanner into the build stage, the first run produces 4,100 findings across a codebase nobody has fully read since 2019, and within three weeks a developer has added continue-on-error: true and moved on. Nothing got safer. The pipeline just got four minutes slower.
DevSecOps works when the gates are few, fast and trustworthy, and fails when they are numerous, slow and wrong. This article covers how to integrate security into CI/CD so the controls survive past the first sprint: which scanner catches what, where each belongs, what should stop a build and what absolutely should not, and how to handle the legacy backlog without pretending it doesn't exist.
What "shift left" actually means
The useful version of the idea is narrow: move a check to the earliest point where the person who can fix it still holds the context. A developer who gets a finding on their own pull request, about code they wrote twenty minutes ago, will fix it. The same finding delivered six weeks later in a spreadsheet goes into a backlog labelled "security debt" and dies there.
It backfires when "earliest" gets confused with "all of it, in the build". A full dynamic scan on every commit doesn't shift anything left; it makes the pipeline take forty minutes and encourages people to batch commits, which is the opposite of what you wanted. Some checks need a deployed application, an hour of crawl time, or a human. Those belong out-of-band, and they are not less valuable for it.
The second backfire is ownership. Moving a check left without moving the ability to act on it means you have relocated the alert, not the work. If a developer cannot suppress a false positive without filing a ticket, they will route around the control instead.

The DevSecOps scanner taxonomy, and what each tool is good at
Six categories cover almost everything sold as DevSecOps tooling. Their precision differs wildly, and treating them as interchangeable "security scans" is the root cause of most noise problems.
SAST (static application security testing) reads your source or its intermediate representation and looks for dangerous patterns: injection sinks fed by untrusted input, unsafe deserialisation, weak crypto calls, path traversal. Modern rule-based engines like Semgrep or CodeQL are genuinely good at the shallow, local stuff — a hardcoded verify=False, a raw SQL string built by concatenation. They are much weaker at anything requiring cross-service reasoning or knowledge of what your framework already sanitises. Expect real signal on the narrow rules and a long tail of complaints about code that is fine.
SCA (software composition analysis) resolves your dependency tree and matches it against vulnerability databases. This is the highest-volume scanner you will run and the one most likely to be wrong in a specific, maddening way: it tells you a CVE exists in a package you ship, not that the vulnerable function is reachable from your code. A deserialisation CVE in a library you use only for date formatting is still a finding. Reachability analysis helps, but treat its "not reachable" verdict as a strong hint, not a proof.
Secrets scanning looks for credentials in source, history, and sometimes build logs. Precision here is the best of any category if you pick the right tool. Entropy-only detection produces garbage; detectors that validate the credential against the issuing service, as TruffleHog's verified mode does, turn a maybe into a yes. Gitleaks is fast and a reasonable default for pre-commit; a verifying scanner is what you want in CI.
IaC scanning parses Terraform, CloudFormation, Kubernetes manifests and Helm charts against misconfiguration rules: public S3 buckets, security groups open to 0.0.0.0/0, containers running as root, missing encryption. Checkov and Trivy are the common choices (Aqua folded tfsec into Trivy, so start new work with Trivy). This category has the best effort-to-value ratio in the list, because findings are usually unambiguous and the fix is a two-line diff. The trap is that generic cloud rules flag patterns that are deliberate in your environment, so tune the ruleset against your own landing-zone conventions before turning the gate on.
Container and image scanning inventories OS packages and application dependencies in a built image and matches them against advisories. Trivy and Grype are the standard open-source options. Output volume depends almost entirely on your base image: a full distro yields hundreds of findings for packages your application never invokes, while a distroless or minimal base collapses the list to something a human can read. Fixing the base image is worth more than tuning the scanner.
DAST (dynamic application security testing) drives a running application and looks for behaviour, not patterns. ZAP (formerly OWASP ZAP, now under the Software Security Project) is the common open-source tool. DAST finds things static analysis structurally cannot: authentication bypasses, misconfigured CORS, exposed admin endpoints, broken access control between two user roles. It is also slow, needs a real environment with real data, and goes flaky when the app under test is still warming up. It does not belong in a per-commit pipeline.
Scanner | What it genuinely catches | What it floods you with | Where it belongs | Blocking? |
|---|---|---|---|---|
Secrets | Live credentials in code, config and history | Test fixtures, example keys, base64 blobs | Pre-commit hook and PR check | Yes — on verified secrets only |
IaC | Public buckets, open security groups, missing encryption, privileged containers | Rules that conflict with your own platform conventions | PR check on changed files | Yes — on a curated high-severity subset |
SAST | Injection sinks, unsafe deserialisation, weak crypto, hardcoded trust | Style-adjacent rules and framework-sanitised paths | PR check, diff-aware | New findings only |
SCA | Known-vulnerable direct dependencies with a fix available | Transitive CVEs with no reachable path and no patch | PR check plus scheduled full scan | Only with fix available and exploit signal |
Image | Vulnerable OS and runtime packages in the shipped artifact | Everything your base image drags in | Post-build, on the artifact | Advisory in CI, enforced at admission |
DAST | Auth bypass, access-control gaps, CORS and header misconfiguration | Timeouts, crawler artefacts, duplicate reports of one bug | Nightly against staging | No |
Where things belong: in-pipeline versus out-of-band
The deciding question is not importance, it's latency. A check earns a place in the pull request path if it finishes in under about ninety seconds on a typical change and its verdict is stable. Everything else runs somewhere the developer isn't waiting.
Diff-aware scanning makes this possible. semgrep ci compares against a baseline commit and reports only findings the change introduced; Trivy can be pointed at changed manifests rather than the whole tree. A full-repository scan still needs to happen, but nightly, where a fifteen-minute run costs nobody anything.
# .github/workflows/security.yml — PR path. Fast, diff-scoped, few gates.
name: security
on: [pull_request]
permissions:
contents: read
security-events: write # lets findings land in code scanning, not just logs
jobs:
pr-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # secrets + baseline diff both need history
- name: Secrets (blocking)
uses: trufflesecurity/trufflehog@<commit-sha> # pin by SHA, not a tag
with:
extra_args: --results=verified # only credentials confirmed live
- name: SAST on the diff (blocking for new findings)
run: semgrep ci # baseline comes from the PR's merge base
env:
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
- name: IaC on changed files (advisory for 90 days, then blocking)
run: trivy config --severity HIGH,CRITICAL --exit-code 0 ./infra
Note what is absent: no image scan (the image isn't built yet on most PRs), no DAST, no full-repo SCA. Those run after merge or overnight.
Blocking and non-blocking gates
Here is the position, stated plainly. A build should block on exactly three things:
A verified live secret. No discussion, no severity triage. The credential works right now.
A new finding in code the author just changed, above a severity threshold you have agreed with the engineers who will fix it. Old findings do not block; only the delta does.
A dependency vulnerability that is both reachable and has a published fix. If there is no patch, blocking the build accomplishes nothing except stopping deployments — including the deployment that would have shipped an unrelated fix.
Everything else is advisory. It annotates the pull request and feeds a dashboard, but it does not hold the merge button hostage.
The failure mode this rule prevents is the CVE with no exploit path blocking a release. A critical-rated vulnerability in a transitive XML parser, in a service that never parses XML, with no upstream patch, will stop your pipeline for days while three people argue. CVSS measures worst-case severity in the abstract and says nothing about your deployment. The CISA Known Exploited Vulnerabilities catalogue and EPSS scores are both free, and both predict "will this be used against me" far better than severity alone. Use them to decide what is worth interrupting work for.
For findings that matter but shouldn't block, enforce at the boundary instead. An image with critical vulnerabilities can fail admission into the production cluster while still building and deploying to staging freely. That puts the control at the point of real risk rather than maximum developer friction, and because admission control runs inside the Kubernetes API server request path, it's unbypassable in a way a CI step never is.
The signal-to-noise problem is the whole game
A scanner that cries wolf gets disabled within a month. Not formally — nobody announces it. Someone adds an exclusion, someone else widens it, and in six weeks the job passes on every commit because it examines almost nothing. You find out during an incident.
The 4,000-finding first scan is the standard way this starts. A number that large is not a security posture, it's a rendering of your dependency tree. It gets exported to a spreadsheet, discussed once, and quietly abandoned.

The fix is a baseline. On the day you turn a scanner on, record every existing finding and mark it as accepted-for-now. The gate applies only to findings that are not in the baseline. The backlog still exists, it's still visible, and it's still someone's problem — but it isn't blocking a developer who is trying to ship an unrelated change.
Suppressions need three properties to stay honest: a reason, an owner, and an expiry date. Tools that support this natively make it much harder to accumulate a permanent graveyard of ignores. Trivy's YAML ignore file does all three:
# .trivyignore.yaml — enable with: trivy image --ignorefile .trivyignore.yaml
vulnerabilities:
- id: CVE-2024-XXXXX
paths: ["usr/local/lib/python3.12/site-packages/example"]
statement: "Parser not reachable; no untrusted input path. Owner: payments-team"
expired_at: 2026-12-01 # after this date the finding returns and blocks again
misconfigurations:
- id: AVD-AWS-0089
statement: "Access logging handled centrally by the org trail. Owner: platform"
expired_at: 2027-03-01
Set a ceiling on total suppressions and review the list quarterly. If it only ever grows, the ruleset is wrong — turn rules off deliberately rather than suppressing their output one finding at a time.
Secrets: rotation matters more than removal
The reflex when a key is found in a commit is to remove it and force-push. That is the wrong priority order. Once a credential has been pushed to a shared remote, assume it is compromised. It is in every clone, in CI caches, in the forks you don't know about, in whatever indexes the repository, and in GitHub's event feed if the repo was ever public. Rewriting history makes it harder to find, not harder to use.
So the runbook is: rotate first, revoke the old value, confirm the new one is in the secret manager, and only then clean up history if you care to. Scanning history is worth doing once as an inventory exercise, but the output is a rotation list, not a commit-rewriting project.
Prevention is where the win is. Push protection at the forge stops the commit before it exists — on GitHub this now sits under Secret Protection, one of the two products the Advanced Security bundle was split into during 2025. A pre-commit hook running Gitleaks catches most of the rest locally. Short-lived OIDC credentials remove the category entirely: if your pipeline never holds a long-lived cloud key, there is nothing to leak.
Signing and provenance
Scanning tells you whether the artifact has known problems. Signing tells you the artifact is the one your pipeline built. They solve different attacks, and a tampered build passes every scanner you own.
The practical baseline is keyless signing with Sigstore's cosign: build identity comes from the CI provider's OIDC token, Fulcio issues a short-lived certificate, and the signature is recorded in Rekor's transparency log. No signing key to store, rotate or lose. Alongside it, generate a provenance attestation recording what was built, from which commit, by which workflow.
SLSA gives you a target. Build L1 means provenance exists. L2 adds a hosted build platform and a signed attestation. L3 further requires the platform to isolate builds from one another and keep signing material out of reach of the build's own code, which is why GitHub documents SLSA v1 Build Level 3 as achievable through artifact attestations generated from a reusable workflow rather than an arbitrary job anyone can edit.
Signing is worth nothing if nobody verifies. Put the verification at admission — Kyverno's image verification rules or Sigstore's policy-controller will reject an unsigned or wrongly-attested image — and make the policy require the specific workflow identity, not merely "signed by someone".

Who owns the fix
The most common structural failure in DevSecOps programmes is a security team that owns the scanner but not the fix. They procure it, configure it, and generate findings. Engineering teams receive those findings and prioritise them against product work, where they lose every time. Six months later the dashboard is red and the engineers regard the whole thing as a tax.
Ownership has to follow the code. The team that owns a service owns its findings, against a target tied to exploit signal rather than raw severity: anything in the KEV catalogue gets fixed within seven days, everything else enters the normal backlog. The security team's job becomes ruleset quality, triage support, and accountability for the false-positive rate as a first-class metric. If their tuning makes developers' lives worse, that shows up in a number they own.
The plumbing belongs to the platform team: the reusable workflow, the baseline files, the suppression review, the signing identity. This is the same argument as any other paved-road capability a platform team provides — the security controls arrive as part of the standard pipeline template rather than as something each team wires up itself. It also means a rule change ships to every repository at once instead of forty pull requests.
A sane order to do this in
Starting from a pipeline with no security controls, the fastest-value sequence is: verified secrets scanning, blocking, on day one. IaC scanning next, advisory for a quarter while you tune, then blocking on a short high-severity list. SAST third, diff-aware and baselined. SCA fourth, reporting only until exploit-signal filtering is in place. Image scanning fifth, enforced at admission rather than in CI. DAST last, nightly, never in the merge path. Signing and provenance are independent of all of it and can start any time.
Two numbers tell you whether it's working. The first is the fraction of builds that fail for a security reason and are then fixed rather than overridden — below about 80%, your gates are wrong. The second is median time from finding to fix for the highest-priority class only; ignore the total backlog count, it measures your dependency tree, not your team. If you want the wider context on how these stages fit around build, test and promotion, our walkthrough of a commit's path from push to production covers the surrounding pipeline, and the rest of our security coverage goes deeper on individual controls.
One caveat worth carrying: every control described here assumes the pipeline itself is trustworthy. A CI system where any engineer can edit the workflow that signs production artifacts, or where third-party actions are pinned to mutable tags, has a bigger problem than any scanner will surface. Pin by digest, restrict who can modify release workflows, and treat the runner as production infrastructure. Otherwise you've built a careful inspection regime around a door that doesn't lock.







