Agent Wranglers

Recommended Open source

Use Trivy to scan images and dependencies

Scan every container image, lock file and infrastructure file with Trivy in CI, and pin Trivy itself by image digest or full commit hash.

Cost

Open source. Apache-2.0 licence, free to run in any build.

How to do it

Trivy's repository opened in April 2019, and 0.76.0 shipped on 14 October 2026. It has never reached 1.0, so record it as an exception. Its GitHub repository had about 38,600 stars in October 2026. One binary scans images, file systems, lock files and Terraform or Kubernetes files. On 19 March 2026, attackers used stolen credentials to publish a malicious Trivy 0.69.4. They also moved 76 of 77 version tags of its GitHub Action to code that stole credentials. The advisory tells users to pin actions to full commit hashes, never version tags. Gate each image as Scan every image before it ships says. Choose something else when a policy bars a tool with a recent supply chain breach. Grype is Apache-2.0, first published in May 2020, and 0.121.0 shipped on 19 October 2026.

Examples

Using these examples: they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

Shell example

TRIVY=aquasec/trivy@sha256:0000000000000000000000000000000000000000000000000000000000000000
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock "$TRIVY" image --exit-code 1 --severity CRITICAL --ignore-unfixed shop:latest
docker run --rm -v "$PWD:/src" "$TRIVY" fs --exit-code 1 --severity CRITICAL /src

YAML example

# The full commit hash of a release you checked, never a tag such as @0.35.0
- uses: aquasecurity/trivy-action@0000000000000000000000000000000000000000
  with:
    image-ref: shop:latest
    exit-code: '1'
    severity: CRITICAL
    ignore-unfixed: true

How to check

Every CI step that runs Trivy names it by image digest or full commit hash, never by tag. The image scan exits non-zero on a critical finding that has a fix.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/stack/delivery-and-infrastructure/trivy">Agent Wranglers software choices playbook</a>. In code you write, add a comment next to it with the same link.