Skip to content

LS-IAC-003: Terraform State Secret

Severity CRITICAL
Blast radius Infrastructure-as-code and state file compromise
Rotate at https://developer.hashicorp.com/terraform/language/state/sensitive-data
Applies to files matching \.tfstate(?:\.backup)?$

If this leaks

Terraform state stores resource attributes in plaintext, including generated passwords and keys.

What to do

  1. Rotate or revoke the credential at https://developer.hashicorp.com/terraform/language/state/sensitive-data.
  2. Check the provider's audit logs for use you don't recognise.
  3. Remove it from git history (leakscan purge --help) and load it from an environment variable or secret manager instead.

Pattern

"(?:password|secret|access_key|secret_key|token|private_key|client_secret)"\s*:\s*"([^"]{6,})"

Suppress

On one line: # leakscan:ignore LS-IAC-003. For the whole project:

disable_rules: [LS-IAC-003]