On 19 March 2026, 76 of 77 version tags of the GitHub Action aquasecurity/trivy-action pointed to malware for about 12 hours, malware that collected credentials from the runner before the actual scan. Trivy is still a useful scanner, just no longer with movable tags. Here is how to check the images of a Compose stack with Trivy 0.76.2 from 5 November 2026, locally and as a gate in GitHub Actions, with the image pinned by digest and the action by commit SHA.
What happened on 19 March
Moved tags and a poisoned release
According to the advisory GHSA-69fq-xp46-6x23 (CVE-2026-33634), an attacker with compromised credentials published a malicious Trivy 0.69.4, moved 76 of 77 tags of trivy-action and replaced all 7 tags of setup-trivy. The malware ran before the real scan, read the memory of the Runner.Worker process, searched more than 50 paths for SSH keys, cloud credentials and .env files, and sent the loot out encrypted. On 22 March, the tampered images 0.69.5 and 0.69.6 followed on Docker Hub.
Which references were safe
In short, from the advisory:
| Reference | Example | Affected in March? |
|---|---|---|
| Action by tag | trivy-action@0.34.2 |
yes, every tag except 0.35.0 |
| Action by commit SHA from 9 April 2025 | trivy-action@<SHA> |
no, provided the commit itself is safe and version: latest was not set during the window |
| Action by commit SHA before 9 April 2025 | trivy-action@<old SHA> |
yes, according to the advisory via the transitively loaded setup-trivy, if the run fell inside its window |
| Image by tag | aquasec/trivy:0.69.4 to 0.69.6, latest during the window |
yes; 0.69.3 and older not |
| Image by digest | aquasec/trivy@sha256:... |
no |
The third row is the real lesson: a SHA pin only freezes the action itself, not what it loads. Only since PR #456 of 9 April 2025 has trivy-action fetched setup-trivy by hash as well. Aqua deleted the old tags without a v and recreated them with one, though three of them (v0.0.10, v0.34.1, v0.34.2) are still missing according to the advisory; on 19 November, git ls-remote --tags showed only 0.35.0 left without a v and confirmed the three gaps, references like @0.28.0 point nowhere.
Scanning the Compose stack locally
The image list comes from Compose
docker compose config --images prints the project's images, one per line, but for build-only services it prints the default name <project>-<service> (without --compatibility), which exists only locally. The script therefore uses the JSON output (--format json) and keeps with jq only the services with image: and without build:; images that a pre_start hook declares of its own are not caught by the filter. Services with both build: and image: drop out as well; for them the name from image: applies, and without pull_policy Compose, according to the docs, pulls the image first and only builds if it is missing from the registry or the local image cache. Services in inactive profiles are missing here; enable them with --profile. If Compose returns nothing, for example because the file is missing, the script aborts instead of passing green.
Trivy by digest, without the Docker socket
The official instructions start the Trivy container with /var/run/docker.sock mounted. I leave that out: according to the Docker docs, only trusted users should be allowed to control the daemon, because without Rootless mode it runs with root privileges; a tampered scanner image could have taken over the whole server. With --image-src remote, Trivy pulls the images from the registry itself:
#!/usr/bin/env bash
# scan-stack.sh: check the registry images of the Compose project, fail on HIGH/CRITICAL
set -uo pipefail
# aquasec/trivy:0.76.2, index digest as of 2026-11-19
TRIVY=aquasec/trivy@sha256:8f6bb947dbc528902e11f2f5be52f7b519f6a39d5d148f41166f2040499768fb
mkdir -p trivy # optional: trivy/.trivyignore
imgs=$(docker compose config --format json \
| jq -r '.services[] | select(.build == null and .image != null) | .image' | sort -u) || exit 2
[ -n "$imgs" ] || { echo "no registry images found" >&2; exit 2; }
rc=0
for img in $imgs; do
docker run --rm -v trivy-cache:/root/.cache/ -v trivy-auth:/root/.docker:ro \
-v "$PWD/trivy:/scan:ro" -w /scan \
"$TRIVY" image --image-src remote --scanners vuln --severity HIGH,CRITICAL \
--ignore-unfixed --exit-code 1 "$img" || rc=1
done
exit "$rc"
The loop runs one image at a time on purpose: the cache is a BoltDB that only one process can access, and parallel runs fail with cache may be in use by another process. By default Trivy exits with code 0 even when it finds something; only --exit-code 1 turns the scan into a gate. According to the docs, --ignore-unfixed is shorthand for --ignore-status affected,will_not_fix,fix_deferred,end_of_life, so only vulnerabilities with an available fix remain. --scanners vuln drops the secret scanner that runs by default (default vuln,secret). Only the trivy directory is mounted, not the project with its .env; Trivy finds a .trivyignore in it through -w /scan, and a missing one is not an error.
Remote checks what a tag currently points to in the registry, for linux/amd64; on ARM hosts add --platform linux/arm64. Only a digest in compose.yaml guarantees that what runs is what Trivy checked; docker compose config --lock-image-digests produces an override file with digests. Inside the container, Trivy sees neither your environment variables nor your ~/.docker/config.json. For private images, the docs recommend trivy registry login per registry, because Trivy sends TRIVY_USERNAME and TRIVY_PASSWORD to every registry in the scan. According to the docs, the login is stored in ~/.docker/config.json, which inside the container is /root/.docker; to survive the --rm container it gets its own volume, mounted read-only in the script above:
TRIVY=aquasec/trivy@sha256:8f6bb947dbc528902e11f2f5be52f7b519f6a39d5d148f41166f2040499768fb
echo "<TOKEN>" | docker run --rm -i -v trivy-auth:/root/.docker \
"$TRIVY" registry login --username <USER> --password-stdin <REGISTRY>
Locally built images you scan as a file in the same directory, under the name Compose uses: the one from image: if set, otherwise <project>-<service>:
TRIVY=aquasec/trivy@sha256:8f6bb947dbc528902e11f2f5be52f7b519f6a39d5d148f41166f2040499768fb
mkdir -p trivy
docker save <IMAGE> -o trivy/app.tar
docker run --rm -v trivy-cache:/root/.cache/ -v "$PWD/trivy:/scan:ro" -w /scan \
"$TRIVY" image --input app.tar --scanners vuln --severity HIGH,CRITICAL \
--ignore-unfixed --exit-code 1
Database and cache, measured
The largest download is not the image at 63.44 MB (amd64, compressed) but the vulnerability database: on 19 November at 08:03 CET, ghcr.io/aquasecurity/trivy-db:2 consisted of a single 141.07 MB layer, measured via the registry manifest. According to the trivy-db README it is built every 6 hours, and the update interval in its metadata is 24 hours. For an existing database with a matching schema, Trivy normally downloads again only after that, and not within 1 hour of the last download. Trivy asks mirror.gcr.io first, then ghcr.io; at 08:12 both served the same build from 01:14 UTC, though shortly after a new build the mirror can temporarily lag one build behind. The trivy-cache volume keeps every run from downloading again. The Java database, 1002 MB, is only added when an image contains JAR, WAR, PAR or EAR files. And --skip-db-update is no use with a fresh cache: Trivy then aborts with --skip-db-update cannot be specified on the first run.
The gate in GitHub Actions
Build, scan and push in one job
The simplest way to make the scan a gate is to put it in the same job before the push: by default every step gets success(), so later steps only run if all previous ones succeeded. A separate scan job would work via needs: too, but it would need the image as an artifact, because GitHub-hosted runners such as ubuntu-latest are a new VM for every job; according to GitHub, self-hosted runners do not need a clean instance for every job. According to the GitHub docs, the push with GITHUB_TOKEN only succeeds if the package is new or has already been connected to the repository; a package pushed by hand into the same namespace earlier and never connected makes the step fail, and a new package starts out private. In the workflow from the post on GitHub Actions with .NET and GHCR, docker/build-push-action builds and pushes in one step; here, build, scan and push are separate:
name: build-scan-push
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
packages: write
jobs:
image:
runs-on: ubuntu-latest
env:
IMAGE: ghcr.io/<OWNER>/<APP>:${{ github.sha }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- run: docker build -t "$IMAGE" .
- uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
with:
version: v0.76.2
image-ref: ${{ env.IMAGE }}
scanners: vuln
severity: HIGH,CRITICAL
ignore-unfixed: true
exit-code: '1'
- if: github.ref == 'refs/heads/main'
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
ACTOR: ${{ github.actor }}
run: |
echo "$TOKEN" | docker login ghcr.io -u "$ACTOR" --password-stdin
docker push "$IMAGE"
git ls-remote gives you the commit. For annotated tags such as v0.36.0, only the line with ^{} is the commit; the first line points to the tag object and does not belong in uses::
$ git ls-remote https://github.com/aquasecurity/trivy-action 'refs/tags/v0.36.0*'
a9c7b0f06e461e9d4b4d1711f154ee024b8d7ab8 refs/tags/v0.36.0
ed142fd0673e97e23eac54620cfb913e5ce36c25 refs/tags/v0.36.0^{}
Defaults I override
Without version, trivy-action v0.36.0 installs Trivy 0.70.0 according to its action.yaml; pinning the action does not bring the current Trivy version with it. The action turns on the cache by itself (cache: true, one cache key per calendar day), which helps against download limits. Careful with format: sarif: the action then drops the severity filter and reports every severity unless limit-severities-for-sarif: true is set. Combined with exit-code: '1', the job then fails on a single LOW finding.
What the error messages mean
TOOMANYREQUESTS during the database download
This line comes from discussion #7538 in the Trivy repository, opened in September 2024, from a comment dated 31 October 2024:
oci download error: failed to fetch the layer: GET https://ghcr.io/v2/aquasecurity/trivy-db/blobs/sha256:b4b4f730819548e788f047001aaea24b40a5227db588422482d3086d2937a552: TOOMANYREQUESTS: retry-after: 890.582µs, allowed: 44000/minute
The GitHub Container Registry throttled downloads of the database; the message names the limit of 44,000 requests per minute. Today Trivy asks mirror.gcr.io first and falls back to the next source on transient errors such as 429 or 5xx; you set your own mirror with --db-repository (Java database: --java-db-repository); the flag replaces the default list, so the default sources only stay if you list them as well.
unable to find the specified image
Anyone who scans an image remotely that only exists locally, such as an image: name that was never pushed, gets this message, shown here in full from the example in Trivy PR #6822 with its example name and without --image-src remote:
$ trivy image --scanners vuln fooooo
2024-05-30T10:30:16+04:00 INFO Vulnerability scanning is enabled
2024-05-30T10:30:19+04:00 FATAL Fatal error image scan error: scan error: unable to initialize a scanner: unable to initialize an image scanner: unable to find the specified image "fooooo" in ["docker" "containerd" "podman" "remote"]: 4 errors occurred:
* docker error: unable to inspect the image (fooooo): Error response from daemon: No such image: fooooo:latest
* containerd error: containerd socket not found: /run/containerd/containerd.sock
* podman error: unable to initialize Podman client: no podman socket found: stat podman/podman.sock: no such file or directory
* remote error: GET https://index.docker.io/v2/library/fooooo/manifests/latest: UNAUTHORIZED: authentication required; [map[Action:pull Class: Name:library/fooooo Type:repository]]
Trivy lists the sources it searched; with --image-src remote the list only says remote. Without the socket, the container cannot see the local Docker daemon, and the image never exists in the registry. The fix: docker save and --input, and in CI the scan right after the build.
Open questions about pins and exceptions
Doesn't --ignore-unfixed hide too much?
It hides everything that has no fix yet. For a gate that is right: it should only block what can be fixed. Review the rest regularly without the switch; deliberately accepted findings belong in .trivyignore with an expiry date, in the script under trivy/.trivyignore, in the docs for example as CVE-2019-14697 exp:2023-01-01. What a finding that fails the gate looks like is shown in the post on the multi-stage Dockerfile for Node and .NET.
Does Trivy also check the compose.yaml itself?
No. According to the Trivy docs, the misconfiguration scanner covers Dockerfile and Containerfile, while Compose is listed with a dash; the request for it is open as issue #8729. trivy config . therefore checks your Dockerfiles, not the Compose file.
How do I keep SHA pins and digests up to date?
Dependabot updates SHA-pinned actions together with the tag comment on the same line:
# .github/dependabot.yml
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
It maintains only the uses: lines; you update the Trivy version under version: and the digest in the script yourself. There are no Dependabot alerts for SHA pins. Since 15 August 2025, SHA pins for actions can be enforced with a setting ("Require actions to be pinned to a full-length commit SHA"); since 28 October 2026, workflow lockfiles have been generally available, according to the changelog on the Free, Team and Enterprise Cloud plans; they also lock the actions that other actions load, and GitHub now ranks them above SHA pinning. Neither covers calls to reusable workflows. According to the Docker docs, a digest never receives security updates by itself; how to learn about new image versions is covered in the post on Diun instead of Watchtower.
Sources and a first step
Trivy
Installation, options and filters are covered by the installation guide, the trivy image reference, the filtering page with .trivyignore, the page on private registries and the troubleshooting page.
GitHub Actions
As a first step, this line lists every uses: line in your workflows without a SHA of 40 hex characters, which also includes branch references, local actions and reusable workflows:
grep -rn 'uses:' .github/workflows | grep -vE '@[0-9a-f]{40}'
The incident is documented in advisory GHSA-69fq-xp46-6x23, the action's inputs in its repository, pinning in GitHub's docs on secure use of Actions and Dependabot for Actions. If you would like your pipelines checked after the incident, I can do that as part of my IT support.
Note: The articles on this blog are produced with the help of AI and are editorially reviewed before publication. Editorial responsibility lies with Emre Yurtbay (see the legal notice).