Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Bug Report: Nested update, permission issue #5404

Closed
2 tasks done
Heargo opened this issue Apr 19, 2023 · 2 comments 路 Fixed by #5395, utopia-php/database#295 or #5887
Closed
2 tasks done

馃悰 Bug Report: Nested update, permission issue #5404

Heargo opened this issue Apr 19, 2023 · 2 comments 路 Fixed by #5395, utopia-php/database#295 or #5887
Assignees
Labels
bug Something isn't working product / databases Fixes and upgrades for the Appwrite Database.
Milestone

Comments

@Heargo
Copy link

Heargo commented Apr 19, 2023

馃憻 Reproduction steps

SETUP
I have a collection Player that is related to the collection playerAttributes and playerAttributes is related to the collection Attributes:
Player -> playerAttributes -> Attributes.

The user A create multiples documents in Attributes. He has all permission on these documents.
The user B create a player and has all permission for the player and playerAttributes documents created.
However, the playerAttributes documents are linked to already created documents in Attributes and the user B only has read permission for the Attributes collection.

馃憤 Expected behavior

The user B should be able to update the player name as he has update permissions on the Player collection.

馃憥 Actual Behavior

When the user B want to update the player name he get the following error :

{"message":"The current user is not authorized to perform the requested action.","code":401,"type":"user_unauthorized","version":"1.3.1"}

This is because he doesn't have update permissions in the Attributes collection.

馃幉 Appwrite version

Version 1.3.x

馃捇 Operating system

Linux

馃П Your Environment

I used appwrite web SDK

馃憖 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

馃彚 Have you read the Code of Conduct?

@Heargo Heargo added the bug Something isn't working label Apr 19, 2023
@stnguyen90 stnguyen90 self-assigned this Apr 19, 2023
@stnguyen90 stnguyen90 added the product / databases Fixes and upgrades for the Appwrite Database. label Apr 19, 2023
@stnguyen90
Copy link
Contributor

@Heargo thanks for creating this issue! 馃檹馃徏 I think this is happening because we're checking permissions using everything in the document:

$data = \array_merge($document->getArrayCopy(), $data);

Rather than just wan'ts passed in. I'm thinking we can solve this issue if I move that to after the the permission check.

@stnguyen90 stnguyen90 added this to the 1.3.2 milestone Apr 19, 2023
stnguyen90 added a commit that referenced this issue Apr 20, 2023
A user should be able to update a document without touching the
relationship.

Relates: #5404
@stnguyen90 stnguyen90 linked a pull request Apr 24, 2023 that will close this issue
13 tasks
@stnguyen90 stnguyen90 reopened this May 11, 2023
@fanatic75 fanatic75 self-assigned this Jul 10, 2023
@abnegate abnegate reopened this Jul 26, 2023
@abnegate abnegate modified the milestones: 1.3.2, 1.4.0 Jul 26, 2023
@stnguyen90 stnguyen90 removed their assignment Aug 3, 2023
@stnguyen90 stnguyen90 linked a pull request Aug 3, 2023 that will close this issue
2 tasks
@fanatic75
Copy link
Contributor

This has been solved in 1.4
@Heargo if you find it still a problem, you can re-open. Closing this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment