Trivy
Active and stableRuns locally ✓No paid APIAn open-source security scanner for repositories and container images that detects vulnerabilities, secrets, and misconfigurations and produces SBOMs and automation-ready reports.
brew install trivyIdeal use for this tool
Best for a developer or small team that wants to scan a project and its container image before merge or release, then enforce the same policy in CI. It creates one checkpoint for vulnerabilities, secrets, and configuration instead of separate scripts. It does not test application logic or prove exploitability, and it needs current security databases.
Details and illustrated features
Green tests do not mean a release is safe. A dependency can contain a known vulnerability, a Dockerfile can introduce a risky setting, or a credential can reach the repository. Trivy is Aqua Security's open-source scanner that brings these checks into one CLI for local work and CI. Its practical value for an individual or small team is a repeatable security checkpoint before merge or deployment without operating a full security platform.
🧭 What is Trivy and how does it work?
Trivy accepts a target such as a project directory, Git repository, container image, root filesystem, VM image, or Kubernetes cluster. It can scan for known vulnerabilities, infrastructure-as-code misconfigurations, secrets, and licenses, and generate an SBOM—a structured inventory of software components.
The engine runs on your machine, but vulnerability scanning needs security databases that Trivy downloads and updates. Some features also access a container registry or remote repository. “Local scan” therefore does not mean “no network”; restricted environments need databases and caches prepared in advance.

Original explanatory diagram, not a Trivy interface screenshot.
🎯 How does it help you?
Suppose you ship a web service in a container. Manually, you would inspect dependency files, the Dockerfile, possible secrets, and several vulnerability sources. With Trivy you can scan the working tree and final image, then apply the same policy in CI: always show findings and fail the job for HIGH or CRITICAL results according to the team's decision.
The added value is not a guarantee of safe software. It is a consistent definition of what gets checked, when it gets checked, and which findings block a release. Application logic tests, design review, SAST, and DAST still cover risks Trivy cannot see.
🌟 Key features and capabilities
1. Multiple targets through one engine
Trivy scans container images, local filesystems, local or remote Git repositories, root filesystems, VM images, and Kubernetes. Depth differs by target: repository scanning focuses on lock files and configuration, while image scanning inspects the built artifact and installed packages.
- Where:
trivy image,trivy fs,trivy repo, andtrivy kubernetes. - How: scan source during development and the final image before release.
- Illustrative example:
trivy image my-app:1.0scans an available local or registry image. - Watch for: private images require registry credentials, and a containerized scan of local Docker images can require the engine socket.

The diagram shows supported target types; scanner behavior varies by target.
2. Vulnerabilities, secrets, configuration, and licenses in structured output
Filesystem scans enable vulnerability and secret scanning by default. Misconfiguration and license scanning need explicit selection in relevant targets. Output can be a human-readable table, JSON for automation, SARIF for GitHub Code Scanning, or an SBOM format for an inventory.
- Where:
--scannersand--format. - How: begin with defaults, then add
misconfigorlicensedeliberately. - Illustrative example:
trivy fs --scanners vuln,secret,misconfig .scans the current project with three scanners. - Watch for: a secret match does not prove the credential is active, and no match does not prove no custom-format secret exists.

Illustration of documented choices, not output from a real project.
3. A configurable CI gate rather than a scan that never fails
Trivy exits with code 0 by default even when it finds issues. Use --exit-code 1 with the selected severities to make it a release gate. GitHub Actions can upload SARIF with security-events: write; a typical checkout and scan needs contents: read.
- Where:
--severity,--exit-code, andaquasecurity/trivy-actioninputs. - How: first display and triage findings, then enforce HIGH and CRITICAL gradually.
- Illustrative example:
trivy fs --severity HIGH,CRITICAL --exit-code 1 .fails CI for matching results. - Watch for: a strict policy without a baseline can block work on old debt or findings without a fix.

The diagram explains the gate. Trivy does not merge or block a PR by itself.
4. Cacheable databases for repeated or restricted scans
The binary contains the engine, not all vulnerability intelligence. Trivy downloads a vulnerability database, Java database when needed, and a checks bundle. You can persist the cache, choose mirrors, or skip updates after preparing data with --skip-db-update and related flags.
- Where: database, cache, and update settings.
- How: update in a connected environment, then move an approved cache or OCI mirror into the restricted network.
- Value: avoids repeated downloads and gives CI a controlled data path.
- Watch for: offline data becomes stale unless you manage updates.

Illustrative data path; mirror locations and update policy depend on your environment.
5. Reviewed exceptions with policy kept outside untrusted code
Results can be filtered by severity and status, and .trivyignore or Rego policies can document specific exceptions. However, Trivy reads trivy.yaml from the working directory by default and can also load ignore and secret configuration files. When scanning an untrusted pull request, keep the CI gate configuration under pipeline control and set --config, --ignorefile, and --secret-config explicitly.
- How: link every exception to an identifier, reason, and review date in your process.
- Example: use a trusted configuration outside the checkout so proposed code cannot weaken the gate.
- Watch for: custom templates can read environment variables; keep them trusted and avoid exposing secrets in reports.

The diagram summarizes the configuration security guidance.
6. Official GitHub Actions and container registry integration
Aqua Security maintains an official GitHub Action and publishes official images through GHCR, Docker Hub, and Public ECR. Private registry scans can use registry-specific environment credentials. Uploading SARIF or an SBOM to GitHub requires permissions beyond a local scan.
Keep credentials in CI secrets rather than commands or tracked files. Grant the least capable token, and pin the Action version or commit instead of using latest in a sensitive pipeline.
🪜 Illustrative workflow: scan a service before merge
Not run on a real repository: you have a Node.js service and a Dockerfile.
- Install an official package or v0.76.2 binary and check
trivy --version. - Run
trivy fs .to inspect dependency vulnerabilities and secrets under the defaults. - Add configuration scanning explicitly with
trivy fs --scanners misconfig .. - Review each finding: file, component, installed version, fixed version, or the justification for an exception.
- Build the image in your environment and run
trivy image my-app:1.0; the image is closer to the release artifact than source alone. - Keep the controlling CI configuration outside PR control, and begin with visible reports.
- After triage, enforce
--severity HIGH,CRITICAL --exit-code 1under team policy. - If you upload SARIF, use
contents: readand addsecurity-events: writeonly as needed.
⚖️ What changes compared with manual work?
| Task | Manual approach | With Trivy |
|---|---|---|
| Component inventory | Inspect separate lock files | Unified analysis and optional SBOM |
| Vulnerabilities | Search multiple feeds | Match detected packages against maintained databases |
| Configuration | Check each Dockerfile or IaC file manually | Updated misconfiguration rules |
| Secrets | Limited text searches | Path- and content-aware secret rules |
| CI | Separate scripts and formats | One CLI with JSON/SARIF and controlled exit codes |
| Exceptions | Scattered notes | Ignore/policy mechanisms that still need governance |

This compares workflow organization, not measured time savings or complete detection.
⚙️ Important configuration
Precedence is CLI flags, then environment variables, then the configuration file. For example, --cache-dir becomes TRIVY_CACHE_DIR. Trivy loads trivy.yaml from the working directory by default, so separate the governing CI policy from the code being scanned. Set --severity, --exit-code, --format, and --scanners deliberately; misconfiguration and license scanners are not enabled by default for every target.
🚀 Installation and first run
The verified release is v0.76.2, published 5 November 2026. Official documentation provides binaries for Linux, macOS, and Windows, official packages, and container images. The documented Homebrew example is:
brew install trivy
trivy --version
trivy fs .
The official container example benefits from a persistent cache, and local Docker image access can require the engine socket:
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \
-v "$HOME/Library/Caches:/root/.cache/" \
aquasec/trivy:0.76.2 image my-app:1.0
Mounting /var/run/docker.sock gives the container broad control over Docker. Do not grant it to an untrusted image; scan an exported tar or a remote registry when that better fits the threat model.
🔗 Integrations and compatibility
Trivy runs on Linux, macOS, and Windows and provides multi-architecture images. It covers many languages, package types, and operating systems, but coverage is not identical; check the Scanning Coverage page for your exact ecosystem. GitHub integration is official, while other ecosystem integrations have different support levels.
💰 Cost, local operation, and privacy
The repository uses the Apache-2.0 license. The CLI is open source and needs no paid API or subscription for local scanning; runner, registry, and cloud service costs remain separate.
Trivy collects anonymous usage telemetry including a hashed installation identifier, version, operating system, and non-user-controlled scan options. Its documentation says file paths, image names, and scan results are not collected. Disable it with --disable-telemetry. The version check still reaches check.trivy.dev unless you also use --skip-version-check, and vulnerability databases require network access or a pre-populated cache/mirror.
⚠️ Limitations and when not to use it alone
- CVE data can lag or contain errors, and a fixed version may not exist.
- A vulnerable dependency does not prove the vulnerable path is exploitable in your application.
- Secret detection uses patterns and can miss custom formats or flag inactive values.
- Repository scanning does not replace scanning the final image, SAST/DAST, or security design review.
--ignore-unfixedand ignore files can hide risk when exceptions are not reviewed.- Full license scanning is computationally expensive and can take time.
🔐 Security and permissions
Local scans need read access to targets and write access to cache. Private images need registry credentials. Kubernetes scans require an appropriate kubeconfig and read permissions. Mounting the Docker socket is highly privileged. In GitHub Actions, use contents: read for scanning and add security-events: write only for SARIF upload; submitting an SBOM to Dependency Graph can need a suitable token. Keep gate configuration and templates outside untrusted PR control, and never print tokens in logs.
📚 Sources and verification date
Original repository · v0.76.2 release · Installation · Filesystem scanning · Databases · Telemetry and privacy · Official GitHub Action.
Checked 11 November 2026. GitHub showed about 39.2K stars and 848 forks; the latest visible main-branch commit was dated 10 November 2026. These are changing popularity and activity signals, not quality or security ratings. Installation and the example were not executed on a real project.