IaC Secrets in Terraform and Azure CSCfg

Detects secrets embedded in Infrastructure as Code files including Terraform/HCL variable assignments and Azure Cloud Service configuration (.cscfg) XML settings. Mirrors Snaffler rule KeepInfraAsCodeByExtension.

Type
regex
Engine
boost_regex
Confidence
high
Confidence justification
High confidence: the combination of secret-bearing key names and non-empty quoted values in IaC contexts is highly specific to credential assignments. Non-secret HCL assignments (region, version, count) do not match because their key names are not in the keyword list.
Jurisdictions
global
Regulations
Criminal Code Act 1995 (Cth)
Frameworks
CIS Controls, ISO 27001, NIST CSF
Data categories
credentials
Scope
specific
Platform compatibility
Purview: Compatible, GCP DLP: Compatible, Macie: Compatible, Zscaler: Compatible, Palo Alto: Degraded, Netskope: Unsupported

Pattern

(?i)(?:password|secret|access_key|api_key|token)\s*=\s*"[^"]{6,256}"

Corroborative evidence keywords

terraform, provider, variable, <ServiceConfiguration, <Role

Proximity: 300 characters

Should match

Should not match

Known false positives

Collections