A DevSecOps Pipeline Starts With Securing the Pipeline Itself
On March 19, 2026, attackers rewrote 76 of 77 version tags of the Trivy GitHub Action, so a security scanner ran stolen-credential malware inside thousands of pipelines. Here is the DevSecOps pipeline that survives that: what to scan at each stage, what should block a merge, and how to harden the runner.
Key takeaways
- A DevSecOps pipeline is a CI/CD pipeline with automated security checks at every stage: secrets scanning before commit, static analysis and dependency scanning on the pull request, container and infrastructure-as-code scanning at build, and an SBOM at release.
- On March 19, 2026, attackers force-pushed malicious code to 76 of the 77 version tags of aquasecurity/trivy-action, and the poisoned tags stayed live for roughly 12 hours, so the pipeline itself is the first thing to harden.
- Pinning an action to a full commit SHA is the control that would have blocked the Trivy tag attack, and GitHub made workflow dependency lockfiles generally available on October 28, 2026 to pin transitive actions as well.
- Vulnerability exploitation is now the top way breaches begin, at 31% of breaches in the Verizon 2026 Data Breach Investigations Report, which is why dependency and container scanning belong in the pipeline.
- Only four findings deserve a hard merge block: critical or high CVEs with known exploits in direct dependencies, detected secrets, SAST injection findings, and infrastructure-as-code that exposes resources to the public internet.
A DevSecOps pipeline is a continuous integration and delivery (CI/CD) pipeline that runs security checks automatically at every stage: secrets scanning before commit, static analysis and dependency scanning on the pull request, container and infrastructure scans at build, and a software bill of materials at release.[7] The stage most teams forget is the pipeline itself.
On March 19, 2026, attackers rewrote 76 of the 77 version tags of aquasecurity/trivy-action, the official GitHub Action for Trivy, a popular open-source vulnerability scanner.[1] For about 12 hours, any workflow that called the action by tag ran credential-stealing code. A security tool was the attack.
Adding Snyk to a pipeline and calling it DevSecOps is like wearing a seatbelt while texting. The tools are not the difference between a good program and a bad one. What matters is whether the checks run where developers already work, and whether the pipeline that runs them can be trusted.
Those four numbers set up the argument. Attackers get in through unpatched software more than anything else,[6] software supply chain failures are now their own category on the OWASP Top 10,[7] and the scanner you installed to help can be the delivery vehicle. So the pipeline needs scans, and it needs to be hardened enough to run them safely.
The Pipeline in Five Stages, and What Runs at Each
Shifting left means moving security checks as early as possible: IDE plugins as you type, pre-commit hooks before code is pushed, CI before code is merged, CD gates before an artifact reaches production. The table below is the whole pipeline on one screen. Start at the top and add rows only after the row above is trusted.
| Stage | What runs | Example tools | Blocks the merge? |
|---|---|---|---|
| 1. Pre-commit | Secrets scanning on the staged diff | Gitleaks, GitHub push protection | Yes |
| 2. Pull request | Static analysis (SAST), dependency scan | Semgrep, CodeQL, Dependabot, Snyk | Injection findings and exploitable CVEs only |
| 3. Build | Container image and infrastructure-as-code (IaC) scan | Trivy, Grype, Checkov | Critical CVEs, public exposure |
| 4. Release | SBOM generation, policy-as-code check | Syft, Open Policy Agent (OPA), Conftest | Policy violations |
| 5. The runner | Pinned actions, read-only token, short-lived cloud credentials | Commit SHAs, workflow lockfile, OIDC | Always on |
Takeaway
Stages one to four find problems in your code. Stage five decides whether the tools that find them can be trusted with your secrets.
Stage Five First: The Scanner Is a Dependency Too
Here is how the Trivy attack worked, from Aqua Security's own advisory.[1] Late in February 2026, an attacker used a misconfiguration in Trivy's own GitHub Actions setup to extract a privileged token. Aqua rotated credentials on March 1, but the rotation was incomplete. On March 19 the attacker used what was left to force-push tags.
Trivy supply chain attack, 2026
A scanner ran malware for 12 hours and the tag name never changed
- Late Feb 2026
Token extracted
An attacker exploits a misconfiguration in Trivy's GitHub Actions environment and pulls out a privileged access token.[1]
- Mar 1
Incomplete rotation
Trivy discloses the earlier incident and rotates credentials. Some stay valid, and the attacker keeps access.[1]
- Mar 19, 17:43 UTC76 of 77
Tags rewritten
Version tags of trivy-action are force-pushed to malicious commits. Only v0.35.0 survives. The payload dumps runner memory to find API tokens, cloud credentials, SSH keys and Kubernetes tokens.[1]
- Mar 20, 05:40 UTC
Window closes
The malicious trivy-action tags are no longer live. Aqua tells users to treat any workflow that ran a mutable tag in the window as compromised and every reachable secret as exposed.[1]
- Mar 26
GitHub answers with a roadmap
GitHub names tj-actions/changed-files, Nx and trivy-action as a pattern: attackers are going after CI/CD automation itself.[2]
Takeaway
A version tag is a label someone can move. A commit SHA is a fingerprint nobody can move. The attack only worked on workflows that trusted the label.
Aqua's guidance is blunt: pin Actions to full commit SHAs, not mutable version tags, and verify the SHA yourself.[1] GitHub's own secure-use guide says the same thing.[5]
I read that advisory and then searched my own workflow files for @master. You should too, because most example snippets on the internet, including the ones in the first version of this article, use exactly that.
SHA pinning has a gap: it covers the actions you call, not the actions those actions call. GitHub's answer is a workflow lockfile at .github/workflows/actions.lock, generated by the gh actions-lock extension, that records the exact commit of every direct and transitive action.[3]
InfoQ reports that it entered public preview on October 14, 2026 and became generally available on October 28, 2026.[4]
Heads up
The rest of the runner checklist is short, and every item comes from GitHub's secure-use guide.[5] Set the default GITHUB_TOKEN permission to read-only and raise it per job. Never put github.event.pull_request.title or any other untrusted value directly in a run step, because the text becomes part of the script.
Assign it to an environment variable first. Use OpenID Connect (OIDC), which hands a workflow a short-lived token, instead of long-lived cloud keys in repository secrets. And avoid pull_request_target unless the job needs a privileged context, such as writing a label to a pull request from a fork.
name: Secure Deploy
on:
push:
branches: [main]
permissions:
contents: read # default to read-only
id-token: write # OIDC: short-lived cloud credentials
security-events: write # SARIF upload
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Configure cloud credentials with OIDC
uses: aws-actions/configure-aws-credentials@<full-commit-sha> # pin the version you audited
with:
role-to-assume: arn:aws:iam::123456789012:role/GitHubActionsDeployRole
aws-region: us-east-1
# Untrusted input goes through env, never straight into the script
- name: Deploy
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: echo "Deploying for: $PR_TITLE"SAST: Run Semgrep on Every Pull Request, CodeQL on Merge
Static application security testing (SAST) reads source code for vulnerabilities without running it. Semgrep is the developer-friendly default: rules are readable YAML, you can write a custom rule for your codebase in minutes, and it is quick enough to gate every pull request.
Its free registry covers the OWASP Top 10 for every major language (our OWASP API Top 10 guide shows what each category looks like in code).[12]
CodeQL is GitHub's semantic engine. It is slower, but it follows data flow, so it can trace a user-controlled value through several function calls and catch injection bugs that pattern matching misses.
Run it on merge to main and weekly on a schedule. SonarQube works better as a quality dashboard than a gate, because its false-positive rate makes it a poor blocker.
name: SAST
on:
pull_request:
branches: [main]
permissions:
contents: read
security-events: write
jobs:
semgrep:
runs-on: ubuntu-latest
container:
image: semgrep/semgrep
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Run Semgrep
run: semgrep ci --config=p/owasp-top-ten --sarif --output=semgrep.sarif
env:
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
- name: Upload SARIF results
uses: github/codeql-action/upload-sarif@<full-commit-sha> # pin the version you audited
with:
sarif_file: semgrep.sarif
if: always()Dependencies and Containers: Where Most Breaches Start
Your application is mostly third-party code, and a vulnerability in a transitive dependency is your vulnerability. Verizon's 2026 report found that exploiting a software vulnerability was the first step in 31% of breaches, ahead of stolen passwords.[6]
OWASP's prevention list for supply chain failures starts with generating an SBOM, tracking transitive dependencies, removing unused ones, and pinning versions deliberately.[7]
- Dependabot or Renovate open pull requests when a new version or advisory lands. Renovate takes longer to configure and gives you grouping, schedules and automerge rules, which pays off on larger repositories.
- Snyk earns its place through reachability analysis. It checks whether your code calls the vulnerable function, which cuts the false positives that plain version-range matching produces.
- OWASP Dependency-Check is free, runs against the National Vulnerability Database, and is a useful second opinion.
For container images, scan at build time and again on a schedule, because base-image vulnerabilities appear after your image was built. Trivy covers OS packages and application dependencies in one scan and also absorbed the older tfsec Terraform scanner. Grype is a good second opinion for critical images.
The irony is not lost on me that I am recommending the tool from the incident above, and I still would. The fix was never to drop the scanner. The fix was to stop calling it by a movable tag.
- name: Build image
run: docker build -t myapp:${{ github.sha }} .
- name: Run Trivy vulnerability scan
uses: aquasecurity/trivy-action@<full-commit-sha> # a SHA you verified, never a tag or master
with:
image-ref: myapp:${{ github.sha }}
format: sarif
output: trivy-results.sarif
severity: CRITICAL,HIGH
exit-code: '1' # fail the build on critical or high findingsShrink the surface before you scan it: build in multiple stages, ship a minimal base image such as distroless, and run as a non-root user. Less in the image means fewer findings to triage.
Secrets Scanning Should Block Merges, Not Warn
My strongest opinion on this page: a secrets finding blocks the merge. A warning a developer can dismiss is a warning that gets dismissed, and a secret that reaches Git history is already compromised. Automated scanners continuously index public repositories for credentials. For private repositories the risk is insiders and accidental exposure.
- Gitleaks scans the staged diff or the full history using patterns and entropy. Run it as a pre-commit hook and again in CI.
- TruffleHog reduces false positives by checking whether a found credential is still valid against the service's API.
- GitHub push protection blocks a push that contains a detected secret before it reaches the repository. It requires GitHub Secret Protection and is off by default at the repository level.[10] Secret Protection is priced at $19 per active committer per month, and Code Security at $30.[11] Anyone with write access can bypass a block by giving a reason, which is logged and emailed to administrators, so treat the bypass log as an audit trail.[10]
repos:
- repo: https://github.com/gitleaks/gitleaks
rev: <pinned-release-tag> # pin to a release you reviewed
hooks:
- id: gitleaksInfrastructure as Code and SBOMs Before You Ship
Infrastructure as code is often the most consequential attack surface. A public storage bucket, an overly permissive identity role, or an unencrypted database can expose more data than an application bug.
Scan Terraform, CloudFormation, Helm charts and Kubernetes manifests with the same rigor as application code. Checkov covers all of those and Dockerfiles, and Trivy now handles Terraform too. Use soft_fail: false only on the checks that expose resources publicly, and leave the rest advisory.
A software bill of materials (SBOM) is, in CISA's words, a nested inventory of the ingredients that make up software components.[8]
Generate one in SPDX or CycloneDX format at build time with Syft and store it next to the release artifact. CISA published draft SBOM guidance in 2025 and joint guidance in 2026 that adds data fields and practices.[8]
On the policy side, the federal rules have moved: Executive Order 14306, signed in June 2025, struck the secure-software attestation provisions that Executive Order 14144 had added, kept NIST Special Publication 800-218 as the reference framework, and does not mention SBOMs at all.[9]
The first version of this article said SBOMs were mandatory for federal vendors. That overstated it. Your customer security questionnaire is the more likely reason to produce one.
Open Policy Agent (OPA) and its Rego language let you write security policy as versioned, tested code, and Conftest runs those policies against Kubernetes manifests, Terraform plans and Dockerfiles in CI. Reach for this after the earlier stages are quiet, not before.
What Should Block a Merge, and What Should Not
Not every finding should stop a release. Gates that are too strict get disabled. Findings that are all advisory get ignored. Both failures are common, and the way out is to sort every finding into one of three buckets before it ever reaches a developer.
Merge policy
Four finding types stop the merge. Everything else waits.
Findings from the scans
- Exploitable critical or high CVEDirect dependency, known exploit
- Secret in code
- SAST injection findingSQL, command, SSRF
- IaC exposes a resource publicly
- Medium CVE, transitive dependency
- Low CVE or code quality note
Merge decision
Decided by the finding type, not by who is in a hurry
What happens
- Block the mergeThe first four types
- Open an issue, merge continuesMedium CVEs, noisy SAST rules
- Dashboard onlyLow CVEs, documented risk acceptances
The calibration is the program. A team that blocks on six categories will be bypassing the gate within a quarter.
Start with secrets and SAST. They are high value and low noise next to the other categories. Get them calibrated and trusted before you add container, IaC or dependency tooling, because every tool that produces noise without action makes developers numb to the next finding. If your pipeline basics are shaky, read what CI/CD is first.
If you ship containers, Docker versus virtual machines covers the isolation trade-offs, and the new Kubernetes versus Docker explainer covers where each tool sits. For the AI-agent version of the same untrusted-input problem, see the prompt injection attack surface and the zero trust security checklist.
The best DevSecOps programs I have seen do not have the most tools. Their developers fix what the tools flag, and their pipeline would survive its own scanner being compromised. Pin the actions first. Everything else is detail.
Sources and further reading
- 1.PrimaryAqua Security, "Trivy supply chain attack: what you need to know". Timeline from late February to March 23, 2026, the 76-of-77 tag count, exposure windows, safe versions and the pin-to-SHA guidance. The advisory also says 75 tags in one passage.
- 2.PrimaryGitHub, "What's coming to our GitHub Actions 2026 security roadmap". March 26, 2026. Names tj-actions/changed-files, Nx and trivy-action; dependency locking, scoped secrets, policy controls and an egress firewall.
- 3.PrimaryGitHub Docs, "Workflow dependency lockfiles". File path, the gh actions-lock extension, what the lockfile guarantees and what it does not cover.
- 4.ReportingInfoQ, "GitHub Actions workflow lockfiles reach general availability". November 6, 2026. Public preview on October 14 and general availability on October 28, 2026. Not yet confirmed against a GitHub changelog entry for GA.
- 5.PrimaryGitHub Docs, "Secure use reference". Pin to a full-length commit SHA, read-only GITHUB_TOKEN, environment variables against script injection, OIDC, and pull_request_target cautions.
- 6.DataVerizon, 2026 Data Breach Investigations Report. Vulnerability exploitation is the top initial access method at 31% of breaches, ahead of stolen passwords. Covers incidents from November 1, 2024 to October 31, 2025.
- 7.PrimaryOWASP Top 10:2025, "A03 Software Supply Chain Failures". Definition, ranking at number three, and the prevention list including SBOMs, transitive dependencies and deliberate version pinning.
- 8.PrimaryCISA, "Software Bill of Materials (SBOM)". SBOM definition, the 2025 draft guidance and the 2026 joint guidance.
- 9.PrimaryFederal Register, Executive Order 14306 (June 11, 2025). Strikes parts of Executive Order 14144, directs NIST guidance based on SP 800-218, and does not mention SBOMs.
- 10.PrimaryGitHub Docs, "About push protection". Requires GitHub Secret Protection, disabled by default at the repository level, bypass with a logged reason.
- 11.PrimaryGitHub, Security features and pricing. Secret Protection at $19 and Code Security at $30 per active committer per month.
- 12.PrimaryOWASP API Security Project. Source for the API risk categories referenced in the pipeline stages.
Frequently asked questions
- What is a DevSecOps pipeline?
- A DevSecOps pipeline is a CI/CD pipeline that runs security checks automatically at every stage instead of leaving them to a late penetration test. Secrets scanning runs before commit, static analysis (SAST) and dependency scanning run on the pull request, container and infrastructure-as-code scans run at build, and an SBOM is generated at release. The point is that a finding reaches the developer who wrote the code within minutes.
- What are the stages of a DevSecOps pipeline?
- There are five: pre-commit (secrets scanning), pull request (SAST and dependency scanning), build (container and infrastructure-as-code scanning), release (SBOM and policy checks), and the runner itself (pinned actions, least-privilege tokens, short-lived cloud credentials). Most teams skip the fifth, and the March 2026 Trivy compromise shows why it matters.
- Should security scans block a merge or just warn?
- Block on four things only: critical or high CVEs with known exploits in direct dependencies, detected secrets, SAST injection findings, and infrastructure-as-code that exposes resources publicly. Medium CVEs in transitive dependencies and noisy SAST rules should open an issue instead. Gates that are too strict get disabled, and findings that are all advisory get ignored.
- Semgrep or CodeQL for SAST?
- Use both at different points. Semgrep is fast and its rules are readable YAML, so it can run on every pull request. CodeQL is slower but traces a user-controlled value through multiple function calls, so run it on merge to main and weekly. Neither replaces the other.
- How do I harden GitHub Actions?
- Pin every action to a full-length commit SHA, set the default GITHUB_TOKEN permission to read-only, pass untrusted values through an environment variable instead of interpolating them into a run step, use OpenID Connect for cloud credentials, and avoid pull_request_target unless you need it. Since October 28, 2026, GitHub workflow dependency lockfiles also pin transitive actions.
- What is an SBOM and do I need one?
- A software bill of materials (SBOM) is a nested inventory of every component in your software, including transitive dependencies. CISA calls it a key building block of supply chain risk management, and OWASP lists generating and managing one as a first prevention step for software supply chain failures. Generate it in SPDX or CycloneDX format at build time and store it with the release artifact.
Written by
Tech Talk News Editorial
Computer engineering background. Writes about software, AI, markets, and real estate, and the places where the three meet.
More about the author