Skip to content

Commit ab82635

Browse files
authored
fix: Parse Server option masterKeyIps does not include localhost by default for IPv6 (#8322)
1 parent 6f52744 commit ab82635

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

spec/index.spec.js

+5
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,11 @@ describe('server', () => {
508508
}).then(done);
509509
});
510510

511+
it('should set default masterKeyIps for IPv4 and IPv6 localhost', () => {
512+
const definitions = require('../lib/Options/Definitions.js');
513+
expect(definitions.ParseServerOptions.masterKeyIps.default).toEqual(['127.0.0.1', '::1']);
514+
});
515+
511516
it('should load a middleware', done => {
512517
const obj = {
513518
middleware: function (req, res, next) {

src/Options/Definitions.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,9 @@ module.exports.ParseServerOptions = {
303303
masterKeyIps: {
304304
env: 'PARSE_SERVER_MASTER_KEY_IPS',
305305
help:
306-
"(Optional) Restricts the use of master key permissions to a list of IP addresses.<br><br>This option accepts a list of single IP addresses, for example:<br>`['10.0.0.1', '10.0.0.2']`<br><br>You can also use CIDR notation to specify an IP address range, for example:<br>`['10.0.1.0/24']`<br><br>Special cases:<br>- Setting an empty array `[]` means that `masterKey`` cannot be used even in Parse Server Cloud Code.<br>- Setting `['0.0.0.0/0']` means disabling the filter and the master key can be used from any IP address.<br><br>To connect Parse Dashboard from a different server requires to add the IP address of the server that hosts Parse Dashboard because Parse Dashboard uses the master key.<br><br>Defaults to `['127.0.0.1']` which means that only `localhost`, the server itself, is allowed to use the master key.",
306+
"(Optional) Restricts the use of master key permissions to a list of IP addresses.<br><br>This option accepts a list of single IP addresses, for example:<br>`['10.0.0.1', '10.0.0.2']`<br><br>You can also use CIDR notation to specify an IP address range, for example:<br>`['10.0.1.0/24']`<br><br>Special cases:<br>- Setting an empty array `[]` means that `masterKey`` cannot be used even in Parse Server Cloud Code.<br>- Setting `['0.0.0.0/0']` means disabling the filter and the master key can be used from any IP address.<br><br>To connect Parse Dashboard from a different server requires to add the IP address of the server that hosts Parse Dashboard because Parse Dashboard uses the master key.<br><br>Defaults to `['127.0.0.1', '::1']` which means that only `localhost`, the server itself, is allowed to use the master key.",
307307
action: parsers.arrayParser,
308-
default: ['127.0.0.1'],
308+
default: ['127.0.0.1', '::1'],
309309
},
310310
maxLimit: {
311311
env: 'PARSE_SERVER_MAX_LIMIT',

src/Options/docs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
* @property {String} logLevel Sets the level for logs
5959
* @property {String} logsFolder Folder for the logs (defaults to './logs'); set to null to disable file based logging
6060
* @property {String} masterKey Your Parse Master Key
61-
* @property {String[]} masterKeyIps (Optional) Restricts the use of master key permissions to a list of IP addresses.<br><br>This option accepts a list of single IP addresses, for example:<br>`['10.0.0.1', '10.0.0.2']`<br><br>You can also use CIDR notation to specify an IP address range, for example:<br>`['10.0.1.0/24']`<br><br>Special cases:<br>- Setting an empty array `[]` means that `masterKey`` cannot be used even in Parse Server Cloud Code.<br>- Setting `['0.0.0.0/0']` means disabling the filter and the master key can be used from any IP address.<br><br>To connect Parse Dashboard from a different server requires to add the IP address of the server that hosts Parse Dashboard because Parse Dashboard uses the master key.<br><br>Defaults to `['127.0.0.1']` which means that only `localhost`, the server itself, is allowed to use the master key.
61+
* @property {String[]} masterKeyIps (Optional) Restricts the use of master key permissions to a list of IP addresses.<br><br>This option accepts a list of single IP addresses, for example:<br>`['10.0.0.1', '10.0.0.2']`<br><br>You can also use CIDR notation to specify an IP address range, for example:<br>`['10.0.1.0/24']`<br><br>Special cases:<br>- Setting an empty array `[]` means that `masterKey`` cannot be used even in Parse Server Cloud Code.<br>- Setting `['0.0.0.0/0']` means disabling the filter and the master key can be used from any IP address.<br><br>To connect Parse Dashboard from a different server requires to add the IP address of the server that hosts Parse Dashboard because Parse Dashboard uses the master key.<br><br>Defaults to `['127.0.0.1', '::1']` which means that only `localhost`, the server itself, is allowed to use the master key.
6262
* @property {Number} maxLimit Max value for limit option on queries, defaults to unlimited
6363
* @property {Number|String} maxLogFiles Maximum number of logs to keep. If not set, no logs will be removed. This can be a number of files or number of days. If using days, add 'd' as the suffix. (default: null)
6464
* @property {String} maxUploadSize Max file size for uploads, defaults to 20mb

src/Options/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ export interface ParseServerOptions {
4949
/* URL to your parse server with http:// or https://.
5050
:ENV: PARSE_SERVER_URL */
5151
serverURL: string;
52-
/* (Optional) Restricts the use of master key permissions to a list of IP addresses.<br><br>This option accepts a list of single IP addresses, for example:<br>`['10.0.0.1', '10.0.0.2']`<br><br>You can also use CIDR notation to specify an IP address range, for example:<br>`['10.0.1.0/24']`<br><br>Special cases:<br>- Setting an empty array `[]` means that `masterKey`` cannot be used even in Parse Server Cloud Code.<br>- Setting `['0.0.0.0/0']` means disabling the filter and the master key can be used from any IP address.<br><br>To connect Parse Dashboard from a different server requires to add the IP address of the server that hosts Parse Dashboard because Parse Dashboard uses the master key.<br><br>Defaults to `['127.0.0.1']` which means that only `localhost`, the server itself, is allowed to use the master key.
53-
:DEFAULT: ["127.0.0.1"] */
52+
/* (Optional) Restricts the use of master key permissions to a list of IP addresses.<br><br>This option accepts a list of single IP addresses, for example:<br>`['10.0.0.1', '10.0.0.2']`<br><br>You can also use CIDR notation to specify an IP address range, for example:<br>`['10.0.1.0/24']`<br><br>Special cases:<br>- Setting an empty array `[]` means that `masterKey`` cannot be used even in Parse Server Cloud Code.<br>- Setting `['0.0.0.0/0']` means disabling the filter and the master key can be used from any IP address.<br><br>To connect Parse Dashboard from a different server requires to add the IP address of the server that hosts Parse Dashboard because Parse Dashboard uses the master key.<br><br>Defaults to `['127.0.0.1', '::1']` which means that only `localhost`, the server itself, is allowed to use the master key.
53+
:DEFAULT: ["127.0.0.1","::1"] */
5454
masterKeyIps: ?(string[]);
5555
/* Sets the app name */
5656
appName: ?string;

0 commit comments

Comments
 (0)