Ccodemod

codemod/arm-detect-weak-tls-protocols

Scan Azure Resource Manager (ARM) JSON templates to detect resources and properties that explicitly enable obsolete or weak SSL/TLS protocol versions such as SSLv2, SSLv3, TLS 1.0, or TLS 1.1, then report findings with per-resource metrics and remediation guidance toward TLS 1.2+ or service-specific secure defaults.

analysisarmazurejsonsecuritytls
Public
0 executions

Run locally

npx codemod @codemod/arm-detect-weak-tls-protocols

@codemod/arm-detect-weak-tls-protocols

Scan Azure Resource Manager (ARM) JSON templates to detect resources and properties that explicitly enable obsolete or weak SSL/TLS protocol versions such as SSLv2, SSLv3, TLS 1.0, or TLS 1.1, then report findings with per-resource metrics and remediation guidance toward TLS 1.2+ or service-specific secure defaults.

Installation

bash

Usage

This package is read-only. It does not rewrite source files.

It analyzes *.json files that look like ARM templates and emits:

  • Structured findings for insecure protocol declarations in ARM resources
  • codemod:metrics counters for insecure findings, scanned resources/templates, secure declarations, and unresolved expression-based sinks
  • Remediation guidance for enforcing modern TLS protocol baselines

The codemod inspects explicit protocol configuration such as:

  • Scalar version fields like minTlsVersion, minimumTlsVersion, minimumTlsVersionAllowed, and tlsVersion
  • Array-valued fields like supportedProtocols, enabledProtocols, sslProtocols, and tlsVersions
  • Nested SSL/TLS policy blocks such as sslPolicy and sslProfiles

Direct ARM references like [parameters('minTlsVersion')] and [variables('protocolList')] are resolved when the referenced value is statically available in the same template. Unresolved expressions are counted via metrics but are not reported as insecure unless a weak protocol is provably present.

Excluded cases:

  • Non-ARM JSON files
  • ARM templates with no explicit protocol-related settings
  • Secure-only declarations such as TLS1_2, TLS1_3, 1.2, or 1.3
  • Disabled protocol lists like disabledProtocols and disabledSslProtocols
  • Parameter or variable declarations that are never used by a resource protocol sink

Each finding includes:

  • severity: security-warning
  • file path
  • dotted property path and JSON pointer
  • resource type, API version, and statically known resource name
  • matched raw value and normalized protocol
  • confidence: literal|resolved
  • remediation guidance such as Set minimumTlsVersion to TLS1_2 or newer

Metrics

  • arm_weak_tls_findings_total
  • arm_weak_tls_resources_total
  • arm_protocol_declarations_insecure_total
  • arm_protocol_declarations_secure_total
  • arm_protocol_occurrences_by_version_total
  • arm_protocol_resolution_unresolved_total
  • arm_protocol_resolution_resolved_total
  • arm_resources_scanned_total
  • arm_templates_scanned_total

Development

bash

License

MIT

Ready to contribute?

Build your own codemod and share it with the community.