What is IaC security scanning and why is it needed?
BeginnerConceptCheckov
Answer
Short answer
IaC scanning analyses Infrastructure-as-Code files — Terraform, CloudFormation, Kubernetes YAML, Helm, Dockerfiles, ARM/Bicep — before anything is deployed, to catch security misconfigurations like public S3 buckets, open SSH to the internet, unencrypted databases or containers running as root.
Why it matters
- Most cloud breaches come from misconfiguration, not clever hacking.
- IaC means one mistake in a module is copied to every environment.
- Fixing a line in a PR is far cheaper than cleaning up after a data leak (shift left).
Typical findings
| Resource | Misconfiguration |
|---|---|
| S3 bucket | No encryption, public ACL, no versioning, no access logging |
| Security group | Port 22/3389 open to 0.0.0.0/0 |
| RDS | Publicly accessible, no encryption, no backups |
| IAM | Policy with "Action": "*" and "Resource": "*" |
| Kubernetes | privileged: true, no resource limits, runs as root, latest tag |
Tools
Checkov, Trivy config (includes former tfsec), KICS, Terrascan, cloud-native policy engines (OPA/Conftest, Sentinel).
What to say in the interview
"IaC scanning checks infrastructure code for misconfigurations before deployment — public buckets, open security groups, missing encryption — because misconfigurations cause most cloud incidents and IaC replicates mistakes everywhere."
More on Checkov
What is Checkov and how do you scan Terraform with it?BeginnerWhat is Checkov?BeginnerHow do you scan Terraform code with Checkov?BeginnerWhy scan the Terraform plan with Checkov instead of only the .tf files?IntermediateHow do you scan Kubernetes manifests and Dockerfiles with Checkov?BeginnerHow do you skip a Checkov check with a documented reason?Intermediate