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-oauth-token-exposed.md.
A documentation index is available at /llms.txt.
Amplify app OAuth tokens must not be embedded directly in templates or supplied as parameters with a Default value because plaintext or defaulted tokens can be exposed via source control, template snapshots, or CI/CD logs and would allow unauthorized access to linked source repositories and deployment pipelines.
This rule checks resources of type AWS::Amplify::App and the Properties.OauthToken value.
OauthToken must not be a literal token string.
OauthToken must not be a Ref/value that resolves to a parameter which defines a Default.
Instead, supply the token via a secrets service (for example, an AWS Secrets Manager or AWS Systems Manager Parameter Store (SecureString) dynamic reference) or via a parameter that has no Default and is injected at deploy time.
This rule flags token-like literal values or parameter references where the referenced Parameters.<name>.Default is defined and does not consider Secrets Manager/SSM dynamic references as violations.
Resources:NewAmpApp-2:Type:AWS::Amplify::AppProperties:BuildSpec:StringCustomHeaders:StringDescription:StringEnableBranchAutoDeletion:trueIAMServiceRole:StringName:NewAmpAppRepository:StringOauthToken:!Sub '{{resolve:secretsmanager:${MyAmpAppSecretManagerRotater}::password}}'MyAmpAppSecretManagerRotater:Type:AWS::SecretsManager::SecretProperties:Description:'This is my amp app instance secret'GenerateSecretString:SecretStringTemplate:'{"username": "admin"}'GenerateStringKey:'password'PasswordLength:16ExcludeCharacters:'"@/\'