설명
Amplify의 AccessToken은 GitHub 저장소 연결을 승인하는 개인용 액세스 토큰입니다. 토큰은 Secrets Manager에 저장하고 템플릿에서는 동적 참조로 전달하세요.
잠재적 영향
토큰을 템플릿이나 파라미터 기본값에 넣으면 저장소 이력을 읽는 사람에게 GitHub 토큰의 권한까지 노출될 수 있습니다.
해결 방법
실제 토큰이 노출됐다면 GitHub에서 폐기하세요. 다시 연결할 때는 GitHub가 발급한 새 토큰을 사용하고 의도한 저장소에서 배포되는지 확인하세요.
예시
RepositoryUrl에는 GitHub 저장소 URL을, MyAmpAppSecretManagerRotater에는 token 키에 발급받은 토큰을 저장한 시크릿의 이름이나 ARN을 지정하세요.
변경 전
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
변경 후
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}}'