What is Trivy and what can it scan?
BeginnerConceptTrivy
Answer
Short answer
Trivy (by Aqua Security) is a fast, open-source, all-in-one security scanner. It finds vulnerabilities (CVEs) in OS packages and app dependencies, misconfigurations in IaC (Terraform, Kubernetes YAML, Dockerfiles, Helm), exposed secrets, and licences, and it can generate SBOMs.
Targets
| Command | Scans |
|---|---|
trivy image nginx:1.27 |
Container image (OS packages + app libraries) |
trivy fs . |
Project folder: lockfiles (package-lock, pom, requirements), secrets, misconfigs |
trivy config ./terraform |
IaC misconfigurations |
trivy repo https://github.com/org/app |
A remote Git repo |
trivy k8s --report summary cluster |
A running Kubernetes cluster |
trivy sbom sbom.cdx.json |
An existing SBOM |
Install
brew install trivy
# or
docker run --rm aquasec/trivy:latest image nginx:1.27
What to say in the interview
"Trivy is an all-in-one scanner: CVEs in images and dependency lockfiles, IaC misconfigurations, secrets and licences, plus SBOM generation. We use trivy fs early in CI, trivy image after the build, and trivy config for Terraform and Kubernetes manifests."
More on Trivy
What is Trivy and how do you scan an image with it?BeginnerWhat is a CVE and what do severity levels mean?BeginnerHow do you scan a Docker image with Trivy?BeginnerHow do you fail a CI build when Trivy finds HIGH or CRITICAL vulnerabilities?BeginnerWhat does trivy fs do?BeginnerWhat does trivy config scan?Beginner