What does trivy config scan?
BeginnerHands-onTrivy
Answer
Short answer
trivy config scans Infrastructure as Code for security misconfigurations — Terraform, CloudFormation, Kubernetes manifests, Helm charts, Dockerfiles and more — using built-in policies (the former tfsec rules live in Trivy now).
Examples
trivy config ./terraform
trivy config ./k8s
trivy config --severity HIGH,CRITICAL --exit-code 1 .
trivy config Dockerfile
helm template ./chart | trivy config - # not supported via stdin; instead:
trivy config ./chart # Trivy renders Helm charts itself
Typical findings
| File | Finding |
|---|---|
| Terraform | S3 bucket without encryption / public access block; security group open to 0.0.0.0/0 on port 22 |
| Kubernetes | Container runs as root; no resource limits; privileged: true; hostPath mounts |
| Dockerfile | No USER (runs as root); ADD from a URL; latest tag |
Output example
AVD-AWS-0107 (HIGH): Security group rule allows ingress from public internet.
main.tf:14 cidr_blocks = ["0.0.0.0/0"]
What to say in the interview
"trivy config checks Terraform, Kubernetes, Helm and Dockerfiles against misconfiguration policies — open security groups, unencrypted buckets, root containers. We run it in PRs alongside or instead of Checkov."
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?BeginnerWhat is Trivy and what can it scan?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?Beginner