Skip to content

Commit 3bdc0cc

Browse files
alvaroOSAflovilmart
alvaroOSA
authored andcommitted
Update security.md (#439)
Parse.Cloud.useMasterKey has been deprecated and converted to a no-op in Parse Server version 2.3.0, I'm correcting this in this document as it is confusing users.
1 parent db701f0 commit 3bdc0cc

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

_includes/common/security.md

+2-12
Original file line numberDiff line numberDiff line change
@@ -508,21 +508,11 @@ Common scenarios that warrant validation include:
508508

509509
While validation often makes sense in Cloud Code, there are likely certain actions that are particularly sensitive, and should be as carefully guarded as possible. In these cases, you can remove permissions or the logic from clients entirely and instead funnel all such operations to Cloud Code functions.
510510

511-
When a Cloud Code function is called, it can invoke the `useMasterKey` function to gain the ability to modify user data. With the master key, your Cloud Code function can override any ACLs and write data. This means that it'll bypass all the security mechanisms you've put in place in the previous sections.
511+
When a Cloud Code function is called, it can use the optional `{useMasterKey:true}` parameter to gain the ability to modify user data. With the master key, your Cloud Code function can override any ACLs and write data. This means that it'll bypass all the security mechanisms you've put in place in the previous sections.
512512

513513
Say you want to allow a user to "like" a `Post` object without giving them full write permissions on the object. You can do this by having the client call a Cloud Code function instead of modifying the Post itself:
514514

515-
The master key should be used carefully. When invoked, the master key is in effect for the duration of the Cloud Code function in which it is called:
516-
517-
```js
518-
Parse.Cloud.define("like", function(request, response) {
519-
Parse.Cloud.useMasterKey();
520-
// Everything after this point will bypass ACLs and other security
521-
// even if I do things besides just updating a Post object.
522-
});
523-
```
524-
525-
A more prudent way to use the master key would be to pass it as a parameter on a per-function basis. For example, instead of the above, set `useMasterKey` to `true` in each individual API function:
515+
The master key should be used carefully. setting `useMasterKey` to `true` only in the individual API function calls that need that security override:
526516

527517
```js
528518
Parse.Cloud.define("like", function(request, response) {

0 commit comments

Comments
 (0)