-
Notifications
You must be signed in to change notification settings - Fork 79
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
Anyone can add child records to a parent model #2951
Comments
Hi @karldanninger 👋 Thanks for raising this issue! To reproduce this issue, I deployed the shared schema and I tried creating some todos as User A with no tasks. I was not able to view the task as User A on a refetch of Todos and their tasks: I can view the task as User B. However, I am not able to query the Todo owned by User A even though I have access to the Task. As a guest (API KEY) user, I am able to see the task created by User B on User A's todo: I'm not sure if this is a bug exactly, these responses make sense considering the auth rules. Owner Auth prevents one particular authenticated user from accessing or manipulating another user's. However, the behavior of creating a relationship between records different users own does seem to occur. I will bring this to the team for further investigation and/or discussion. |
Hi @karldanninger, after discussing with the team, this is expected behavior but could potentially be mitigated by extending the auto-generated resolvers and slotting in a custom resolver into the pipeline that fetches the Todo and then compares the owner in the createTask input to the Todo owner. For more information on how to slot in resolvers, please refer to the Gen 1 documentation: Slotting in resolvers is not currently supported in Gen 2. Lastly, I transferred this issue over from the |
Hey 👋 , This issue is being closed due to inactivity. If you are still experiencing the same problem and need further assistance, please feel free to leave a comment. This will enable us to reopen the issue and provide you with the necessary support. |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
GraphQL API
Amplify Version
v6
Amplify Categories
api
Backend
Amplify CLI
Environment information
Describe the bug
Anyone (authenticated) can create a child
Task
of aTodo
owned by someone else.Is there a way to prevent this?
Expected behavior
Adding a
Task
to aTodo
owned by someone else should return 'Unauthorized'.Reproduction steps
Outlined below in code snippet.
Code Snippet
schema.graphql
running a createTask query on the client as any authenticated user
Log output
aws-exports.js
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: