Skip to content

Commit 52c4dd3

Browse files
pungmeflovilmart
authored andcommitted
Refactor masterKeyIps and update readme (#4050)
* update choose_password to have the confirmation * just a revert to the old one * refactor and update readme * just revert some spaces
1 parent 952e64d commit 52c4dd3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ The client keys used with Parse are no longer necessary with Parse Server. If yo
223223
* `passwordPolicy` - Optional password policy rules to enforce.
224224
* `customPages` - A hash with urls to override email verification links, password reset links and specify frame url for masking user-facing pages. Available keys: `parseFrameURL`, `invalidLink`, `choosePassword`, `passwordResetSuccess`, `verifyEmailSuccess`.
225225
* `middleware` - (CLI only), a module name, function that is an express middleware. When using the CLI, the express app will load it just **before** mounting parse-server on the mount path. This option is useful for injecting a monitoring middleware.
226+
* `masterKeyIps` - The array of ip addresses where masterKey usage will be restricted to only these ips. (Default to [] which means allow all ips). If you're using this feature and have `useMasterKey: true` in cloudcode, make sure that you put your own ip in this list.
226227

227228
##### Logging
228229

src/middlewares.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ export function handleParseHeaders(req, res, next) {
111111
req.config.headers = req.headers || {};
112112
req.info = info;
113113

114-
const ip = getClientIp(req);
115-
if (info.masterKey && req.config.masterKeyIps && req.config.masterKeyIps.length !== 0 && req.config.masterKeyIps.indexOf(ip) === -1) {
114+
if (info.masterKey && req.config.masterKeyIps && req.config.masterKeyIps.length !== 0 && req.config.masterKeyIps.indexOf(getClientIp(req)) === -1) {
116115
return invalidRequest(req, res);
117116
}
118117

0 commit comments

Comments
 (0)