-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
CLP (Read only) and write request using master key: #1976
Comments
Where are you calling createNewEntry - in Cloud Code or client side JS? Cloud Code is trusted so the master key will be set when the SDK is initialized. You can also pass this to the JS SDK if initializing yourself but must only do so if the code is in a trusted environment. Might be worth testing the same code with the ACL modification removed so you can see if there is a problem with just CLP and standard saving using the master key. You could also try passing null as the first parameter to save instead of {}. I think either should work but have only tested null. |
I call this function from client side js. i initialized the sdk with the mater key. I also tried the null param instead the {} variant with the same result. when i change the clp permission and add write permission it works. |
I'll have a look tomorrow. Do you confirm the behavior is different than on parse.com? |
Something is sure, that should pass with the masterKey |
This is plain wrong... You should not let your masterKey in the client SDK! |
I just ran some tests, and this behaves correctly, the masterKey is correctly processed when running from the server. Again, the masterKey SHOULD NEVER EVER EVER been sent to the client. Also, if you look at the code here: https://github.com/ParsePlatform/Parse-SDK-JS/blob/master/src/Parse.js#L32 The masterKey is completely ignored when Parse is used in the Client SDK. |
hi. i dont deploy rhe master key with my app. i only use it for admin tasks. but I think When Im using cloud code and do security checks there it should work aswell. thanks |
Can you provide the logs when running parse-server with VERBOSE=1 |
sure, clientcode:
server code (hint: log direction is upside down):
|
When you say client code, from where is that code run from? |
from my workstation (aka. NOT cloud code and NOT on the same device as the server runns) |
How do you |
correct yes:
(the master key is obsolete but doesn't hurt) |
How you do this step?
|
To make it works, you will have to save your function as a cloud function in your parse server cloud code and then call it from client (your workstation). In our main.js, create samething like:
In your client call just function like:
|
@davimacedo thanks for your reply. I don't think having admin related tasks in cloud code make sense - security wise and user wise. @flovilmart any hints from your side? |
@neophob you can first check in your cloud function if user is 'admin' Actually it is the unique way to make it works since sending master key from client (admin is also client) is not recommended/allowed anymore as you can see in the link @flovilmart sent: |
Hmm I'm a bit confused now. In a recent parse SDK commit (parse-community/Parse-SDK-JS@8a3d011) the documentation was updated, the changed text:
So it looks like the docs clearly say we can use the masterKey from node, but how do we actually SET the master key? |
Hi @neophob I've just realized that you are using in a Node.js environment and there userMarterKey: true should be working. Sorry about that. When you pasted your initialization code, you said: "(the master key is obsolete but doesn't hurt)" |
From parse.js sdk (node)
I just saw that the |
any news on this issue? |
seems to work with latest parse server now (v2.2.13) |
Just want to pop in and say that this works for me only if I call |
here is how you override CLPs/ACLs for protected Collections starting with a "_" persay like "_User" aka "User"
|
@haroot I edited the snippet to remove inaccuracies with the latest and future versions of the server |
@flovilmart thanks ill replace the old one in the morning . A lot cleaner, thank you! |
Issue Description
According to the Parse Docs, using the master key for an action should bypass all security checks:
Steps to reproduce
ERROR: ParseError { code: 119, message: 'Permission denied for this action.' }
When I edit the CLP and allow write permission (or only the Create in the advanced section) this code works.
Expected Results
Bypass CLP/ACL Permission when using Master Key
Actual Outcome
No Permission
Environment Setup
The text was updated successfully, but these errors were encountered: