For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/iac_security/iac_rules/cloudformation-aws-amplify-app-access-token-exposed.md.
A documentation index is available at /llms.txt.
Storing an Amplify access token in plaintext or as a parameter Default risks accidental disclosure (for example, via source control, template exports, or build logs) and can allow unauthorized access to connected repositories or services.
This rule checks AWS::Amplify::App resources and the Properties.AccessToken value.
The access token must not be a literal token string.
The access token must not be supplied via a parameter Default containing a token-like value.
Instead, AccessToken should reference a secure secret (for example, an AWS Secrets Manager dynamic reference) or be supplied via a template parameter without a Default and with NoEcho set to true so the token is not embedded in the template.
This rule flags tokens that resemble JWTs or long token strings (for example, >50 characters and dot-separated) when they appear inline or as parameter defaults and when there is no Secrets Manager reference.
Secure example using Secrets Manager dynamic reference:
Resources:NewAmpApp:Type:AWS::Amplify::AppProperties:AccessToken:!Sub '{{resolve:secretsmanager:${MyAmpAppSecretManagerRotater}::password}}'BuildSpec:StringCustomHeaders:StringDescription:StringEnableBranchAutoDeletion:trueIAMServiceRole:StringName:NewAmpAppOauthToken:StringRepository:StringMyAmpAppSecretManagerRotater:Type:AWS::SecretsManager::SecretProperties:Description:'This is my amp app instance secret'GenerateSecretString:SecretStringTemplate:'{"username": "admin"}'GenerateStringKey:'password'PasswordLength:16ExcludeCharacters:'"@/\'