parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

Security Question about PFUser passed along Cloud Code

Open DoneStuffGetting opened this issue 10 years ago • 1 comments

Does Parse Server authenticate/verify/parity-check the user that is passed with Cloud Code calls? Is it safe to trust request.user? Basically, can it be spoofed?

I've defined a few Cloud functions that heavily depend on the user object that is passed via Cloud request and uses the MasterKey to do some find/get/create/update, and I was wondering if Parse Server checks if the user is legit.

If we cannot 100% trust the PFUser from request.user, I would probably need to implement a function that compares the request.user's objectId/sessionToken with the get-retrieved session token using the request.user's objectId (installationId checking would be slightly unnecessary).

DoneStuffGetting avatar Apr 17 '16 05:04 DoneStuffGetting

Similar question from 2012 and inquirer had done exactly what I mentioned above; PFUser was spoofed merely by creating a new user object and setting the objectId.

I also have a feeling that the PFUser object from (request.user) is simply passed on and not verified/authenticated.

I'll be making a PR to the Cloud Code docs regarding this, and how your Cloud Code should not depend solely on the passed on PFUser from the request.

DoneStuffGetting avatar Apr 17 '16 12:04 DoneStuffGetting