-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot setup Storage access permission for Owner if user is in a Group #1771
Comments
Hey @mausic, thank you for reaching out. I was able to reproduce the issue, marking this as bug for further improvements. |
I too hit this problem today. Spoke with Harshita Daddala about it. My use case is similar. I have "ADMINS" and "USERS" - USERS is meant to be a benign holding group. I auto assign the users on signup to USERS and have ADMINS who can access everything. I was surprised to see that the group membership would completely supersede the individual entity level rights. As a developer, I would expect a UNION of role based security of groups and individual user auth rules set in AUTH. I was trying to use FileUploader and StorageImage in a client component (nextjs and mostly server-side rendering in my application). The URL was being correctly created in the FileUploader component, with the correct identityId, which is what caused me so much trouble in tracking down what was happening. I eventually inspected the error in the console and saw:
As you can see, I have commented out the triggered lambda which auto-assigns to USERS group. Also removed the impacted user (I'm still in dev mode, so it's a single account) from the USERS group. Permission errors went away. |
Environment information
Description
In AWS Amplify Gen 2.0 there is an issue or a bug related to Owner-based storage permissions and auth groups.
If authenticated user is within a Group, for example,
Users
, it is impossible to set up Owner-based access rules for Storage without specifying the same-level group permission.For example.
auth
setup atamplify/auth/resource.ts
filestorage
setup atamplify/storage/resource.ts
Users
group.Now, if we try to upload a file such as
we will get
AccessDenied
error.The only way to fix this is to either remove the user from the group (which is breaking business logic relying on user groups) or to change
amplify/storage/resource.ts
file by adding aUsers
group permission to it, such as:which breaks Owner-based storage permissions and allows anyone in the
Users
group to modify other users' files.The text was updated successfully, but these errors were encountered: