Description
Amplify’s AccessToken is a GitHub personal access token that authorizes the repository connection. Store it in Secrets Manager and pass a dynamic reference in the template.
Potential impact
A token in the template or a parameter default can remain in source history. Anyone who obtains it may access GitHub resources within its permissions.
Remediation
Revoke an exposed token in GitHub. If the connection needs to be authorized again, use a newly issued GitHub token and verify a deployment from the intended repository.
Examples
Set RepositoryUrl to the GitHub repository URL and MyAmpAppSecretManagerRotater to the name or ARN of the secret containing the issued token under token.
Before
yaml
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
RepositoryUrl:
Type: String
Resources:
NewAmpApp:
Type: AWS::Amplify::App
Properties:
Name: NewAmpApp
Repository: !Ref RepositoryUrl
AccessToken: ghp_EXAMPLE_NOT_A_REAL_GITHUB_TOKEN
After
yaml
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
RepositoryUrl:
Type: String
MyAmpAppSecretManagerRotater:
Type: String
Resources:
NewAmpApp:
Type: AWS::Amplify::App
Properties:
Name: NewAmpApp
Repository: !Ref RepositoryUrl
AccessToken: !Sub '{{resolve:secretsmanager:${MyAmpAppSecretManagerRotater}:SecretString:token}}'