Plaintext Alexa ASK skill refresh token

Keep Alexa ASK skill refresh tokens out of templates.

Description

Set the Alexa skill’s AuthenticationConfiguration.RefreshToken to a Secrets Manager reference for the issued Login with Amazon token.

Potential impact

A token left in a template can be used with the required client credentials to obtain new access tokens for permitted skill-management actions.

Remediation

Revoke and reissue an exposed token at the issuer. Store clientSecret and refreshToken from the same Alexa Skills Kit security profile in alexa-auth. Update the skill resource so CloudFormation retrieves the new values.

Examples

Supply ClientId and VendorId for the linked developer account, the existing S3 skill package and a role ARN that permits reading it. The second example adds a dynamic reference for the refresh token alongside the existing client-secret reference.

Before

yaml
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
  ClientId:
    Type: String
  VendorId:
    Type: String
  SkillBucket:
    Type: String
  SkillKey:
    Type: String
  SkillBucketRoleArn:
    Type: String
Resources:
  MySkill:
    Type: Alexa::ASK::Skill
    Properties:
      AuthenticationConfiguration:
        ClientId: !Ref ClientId
        ClientSecret: '{{resolve:secretsmanager:alexa-auth:SecretString:clientSecret}}'
        RefreshToken: 'Atzr|1234'
      VendorId: !Ref VendorId
      SkillPackage:
        S3Bucket: !Ref SkillBucket
        S3Key: !Ref SkillKey
        S3BucketRole: !Ref SkillBucketRoleArn

After

yaml
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
  ClientId:
    Type: String
  VendorId:
    Type: String
  SkillBucket:
    Type: String
  SkillKey:
    Type: String
  SkillBucketRoleArn:
    Type: String
Resources:
  MySkill:
    Type: Alexa::ASK::Skill
    Properties:
      AuthenticationConfiguration:
        ClientId: !Ref ClientId
        ClientSecret: '{{resolve:secretsmanager:alexa-auth:SecretString:clientSecret}}'
        RefreshToken: '{{resolve:secretsmanager:alexa-auth:SecretString:refreshToken}}'
      VendorId: !Ref VendorId
      SkillPackage:
        S3Bucket: !Ref SkillBucket
        S3Key: !Ref SkillKey
        S3BucketRole: !Ref SkillBucketRoleArn

References