For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/iac_security/iac_rules/kubernetes-service-account-token-automount-not-disabled.md.
A documentation index is available at /llms.txt.
Service account tokens are automatically mounted even if not necessary. This rule detects workloads where automountServiceAccountToken is set to true on the pod spec or inherited from the referenced ServiceAccount, and flags resources that should set it to false.
Pod-level automountServiceAccountToken takes precedence over the ServiceAccount setting. If the pod-level key is missing, the ServiceAccount value is evaluated.
The rule reports IncorrectValue when the token is enabled, and MissingAttribute when the attribute is undefined on both the pod and the referenced ServiceAccount.