aws-amplify / aws-amplify/amplify-cli

Unable to restrict bucket access by Cognito User Group when importing auth

Open
#10,203 1 comment 0 reactions 0 assignees View on GitHub
auth feature-request p3 storage
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### Before opening, please confirm:

- [X] I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-cli/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-cli/blob/master/CONTRIBUTING.md#bug-reports).
- [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.

### How did you install the Amplify CLI?

npm

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

14.15.0

### Amplify CLI Version

8.0.1

### What operating system are you using?

Mac

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

No manual changes made

### Amplify Categories

auth, storage

### Amplify Commands

configure

### Describe the bug

When importing a Cognito User Pool, the option to restrict CRUD actions for storage by User Groups is no longer there.

### Expected behavior

The ability to restrict access to Storage by Cognito User Groups when importing a User Pool.

### Reproduction steps

1. amplify import auth (follow prompts to import existing Cognito User Pool)
2. amplify add storage

### GraphQL schema(s)

N/A

### Log output

N/A

### Additional information

After digging through some of the code it seems in this line:

https://github.com/aws-amplify/amplify-cli/blob/1daf72029bda79645ee95997c40a887741499164/packages/amplify-category-storage/src/provider-utils/awscloudformation/service-walkthroughs/s3-walkthrough.ts#L83

Must be returning an empty list when it should probably return the imported User Pool's groups.

Looking at this line:
https://github.com/aws-amplify/amplify-cli/blob/1daf72029bda79645ee95997c40a887741499164/packages/amplify-cli/src/extensions/amplify-helpers/get-userpoolgroup-list.ts#L7

It seems it gets the user groups from a file from the repo. Which isn't created when importing auth.

Any help would be greatly appreciated!! 🙏

Contributor guide

Open the contributing guide

Research direction

Start with packages/amplify-category-storage/src/provider-utils/awscloudformation/service-walkthroughs/s3-walkthrough.ts at the referenced line, then inspect packages/amplify-cli/src/extensions/amplify-helpers/get-userpoolgroup-list.ts and the imported-auth project files. Reproduce the flow with amplify import auth followed by amplify add storage; done means imported Cognito User Pool groups appear as choices for restricting storage CRUD access.

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
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.