Trivy
Purpose
Use this skill for focused container, filesystem, and configuration review when the engagement includes build artifacts, images, or IaC.
Phase Fit
- Primary: Vulnerability Analysis
- Secondary: Threat Modeling and Test Planning, Retest and Closure
Use When
- Need to assess a container image, source tree, or IaC for material exposure.
- Need to understand whether known package or config risk affects the target.
- Need a repeatable retest after hardening.
Avoid When
- The target artifact is out of scope.
- Results would be reported without reachability or relevance review.
Inputs
- Approved image, path, or manifest set
- Scan mode aligned to the current hypothesis
- Output handling requirements
Procedure
- Scope the scan to the artifact relevant to the question.
- Triage findings for material and reachable risk.
- Correlate important results with deployed context.
- Avoid flooding the report with low-signal package noise.
- Preserve the exact artifact and scan mode for retest.
Command Syntax
Replace sample paths and images with approved in-scope targets.
# Scan a container image for vulnerabilities
trivy image nginx:latest
# Scan only high and critical severity
trivy image --severity HIGH,CRITICAL nginx:latest
# Output to JSON
trivy image --format json --output contoso-trivy.json nginx:latest
# Scan an IaC configuration directory
trivy config ./terraform/
# Scan filesystem for vulnerabilities, secrets, and misconfigs
trivy fs /path/to/contoso-app/ --scanners vuln,secret,config
# Scan a Kubernetes cluster (summary report)
trivy k8s --report summary cluster
# Scan a specific Kubernetes namespace
trivy k8s --namespace default --report all
Evidence to Capture
- Material image, package, or configuration issues
- Exact artifact and scan mode used
- Reachability or deployment context behind the reported issue
Safety Boundaries
- Keep scans limited to approved artifacts.
- Treat output as triage input, not final findings without review.