Glossary · Scanning and analysis

IaC scanning (infrastructure-as-code scanning)

Infrastructure-as-code (IaC) scanning analyzes the files that define infrastructure, such as Terraform, CloudFormation, Kubernetes manifests, Helm charts and Dockerfiles, for insecure configuration before it is deployed.

When infrastructure is described in code, its security properties are visible in a file before anything exists. An IaC scanner parses those files and evaluates each declared resource against a catalog of rules: a storage bucket with a public ACL, a security group open to 0.0.0.0/0 on SSH, a container that runs as root or with privileged: true, a database without encryption at rest. Rules are typically written in a policy language and identified by stable IDs, and many map to published hardening guidance such as CIS Benchmarks.

How it is used in practice

IaC scanning is one of the cheapest controls in a shift-left programme. It runs in pull requests and CI against the repository that holds the infrastructure definitions, and its findings name a file, a line range and a resource, so the fix is a code change reviewed like any other. It complements CSPM, which inspects what is actually deployed in the cloud, and admission control, which judges a workload at the moment a cluster is asked to run it. Organizations often keep an approved set of rule overrides for risks they have mitigated elsewhere.

Common pitfalls

  • Silent gaps in coverage. A scanner with no analyzer for a file type reports nothing for it, which reads exactly like "clean". Know which formats your tool actually parses.
  • Templated configuration. Helm values, Terraform modules and variables can change the rendered result; scanning only the template can miss what is deployed.
  • Drift. IaC describes intent. Someone changing a resource in the console means the code and the cloud disagree, which only runtime posture checks see.
  • Suppressing instead of overriding. Silencing a finding hides its recurrences; changing a rule's severity for a documented reason keeps them visible.
  • Line-number identity. If a finding's identity includes its line number, inserting a line above it creates a "new" finding and loses its history.

How TrustIvan relates to it

TrustIvan's misconfiguration scanning is opt-in per scan against a repository or filesystem target. It embeds an open-source misconfiguration engine as a library and runs offline against that engine's bundled rule set, which the IaC scanning documentation names. Dockerfiles, Terraform, Kubernetes manifests, Helm charts and CloudFormation are each proven by a fixture test that also requires a clean file to produce nothing, and Azure ARM templates and Ansible playbooks each have their own fixture test with an insecure and a fixed file. docker-compose files are not a supported target, and the docs say so. Each finding carries the file, line range, resolved resource, rule ID and a written resolution. Severity overrides are set per organization with a recorded reason, and finding identity uses the rule and resource, never the line. See IaC scanning.

Related terms

Guides on IaC scanning

On the platform: Container scanning. All glossary terms

See TrustIvan on your own estate.

Book thirty minutes with an engineer and bring an image, a repository or a cloud account, or start free on the hosted service.