aws-amplify / aws-amplify/amplify-cli

User Pool Groups Cloudformation Issue when Special Characters Present

Open
#12,560 4 comments 0 reactions 0 assignees View on GitHub
auth feature-request p3
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### How did you install the Amplify CLI?

npm

### If applicable, what version of Node.js are you using?

_No response_

### Amplify CLI Version

11.1.0 (set to `latest` in CI/CD build job)

### What operating system are you using?

Windows

### Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

N/A

### Describe the bug

When identity pools are enabled and Cognito user groups are specified with names containing special characters, the CloudFormation template will incorrectly reference the role resources with those special characters present. As stated in the AWS Cognito console, "The group name must contain between 1 and 128 non-space characters." However, CloudFormation resources must be only alpha-numeric ([a-zA-Z0-9]). When the CloudFormation template is generated, the "AWS::Cognito::UserPoolGroup" resources are correctly named without the special characters (e.g. "group:test" is provisioned as "groupTestGroup"), but they have a property called "RoleARN" that still has the special characters in the ref (e.g. `"RoleArn": { "Fn::GetAtt": [ "group:testGroupRole", "Arn" ] }`). The CloudFormation parsing engine is not able to recognize that resource and fails. This also happens with the Outputs of the template and the "RoleName" of the "AWS::IAM::Role".

### Expected behavior

It's expected that any generated "Ref"s to CF resources would also properly sanitize for special characters.

### Reproduction steps

1. amplify add auth
2. configure a user pools group with special characters in the name (e.g. ':')
3. enable identity pools for group role-based access

### Project Identifier

_No response_

### Log output

```
# Put your logs below this line

```

### Additional information

_No response_

### Before submitting, please confirm:

- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.

Contributor guide

Open the contributing guide

Research direction

Start with the auth generation path exercised by `amplify add auth`, then reproduce the configuration with a user pool group containing `:` and identity-pool group role access enabled. Inspect the generated CloudFormation template, including `RoleArn`, Outputs, and IAM `RoleName`; done means all generated resource references are sanitized consistently and the template parses successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
authentication, cli, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.