Skip to content

Commit 0806873

Browse files
committed
Merge remote-tracking branch 'upstream/alpha' into alpha
2 parents 26b92fa + 2ae5db1 commit 0806873

File tree

7 files changed

+27
-8
lines changed

7 files changed

+27
-8
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ $ parse-server --appId APPLICATION_ID --masterKey MASTER_KEY --databaseURI mongo
822822
823823
After starting the server, you can visit http://localhost:1337/playground in your browser to start playing with your GraphQL API.
824824
825-
**_Note:_** Do **_NOT_** use --mountPlayground option in production. [Parse Dashboard](https://github.com/parse-community/parse-dashboard) has a built-in GraphQL Playground and it is the recommended option for production apps.
825+
**_Note:_** Do **_NOT_** use --mountPlayground option in production. The GraphQL Playground exposes the master key in the browser page. [Parse Dashboard](https://github.com/parse-community/parse-dashboard) has a built-in GraphQL Playground and is the recommended option for production apps.
826826
827827
### Using Docker
828828
@@ -845,7 +845,7 @@ $ docker run --name my-parse-server --link my-mongo:mongo -v config-vol:/parse-s
845845
846846
After starting the server, you can visit http://localhost:1337/playground in your browser to start playing with your GraphQL API.
847847
848-
**_Note:_** Do **_NOT_** use --mountPlayground option in production. [Parse Dashboard](https://github.com/parse-community/parse-dashboard) has a built-in GraphQL Playground and it is the recommended option for production apps.
848+
**_Note:_** Do **_NOT_** use --mountPlayground option in production. The GraphQL Playground exposes the master key in the browser page. [Parse Dashboard](https://github.com/parse-community/parse-dashboard) has a built-in GraphQL Playground and is the recommended option for production apps.
849849
850850
### Using Express.js
851851
@@ -899,7 +899,7 @@ $ node index.js
899899
900900
After starting the app, you can visit http://localhost:1337/playground in your browser to start playing with your GraphQL API.
901901
902-
**_Note:_** Do **_NOT_** mount the GraphQL Playground in production. [Parse Dashboard](https://github.com/parse-community/parse-dashboard) has a built-in GraphQL Playground and it is the recommended option for production apps.
902+
**_Note:_** Do **_NOT_** mount the GraphQL Playground in production. The GraphQL Playground exposes the master key in the browser page. [Parse Dashboard](https://github.com/parse-community/parse-dashboard) has a built-in GraphQL Playground and is the recommended option for production apps.
903903
904904
## Checking the API health
905905

spec/SecurityCheckGroups.spec.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ describe('Security Check Groups', () => {
3434
config.allowClientClassCreation = false;
3535
config.enableInsecureAuthAdapters = false;
3636
config.graphQLPublicIntrospection = false;
37+
config.mountPlayground = false;
3738
await reconfigureServer(config);
3839

3940
const group = new CheckGroupServerConfig();
@@ -43,6 +44,7 @@ describe('Security Check Groups', () => {
4344
expect(group.checks()[2].checkState()).toBe(CheckState.success);
4445
expect(group.checks()[4].checkState()).toBe(CheckState.success);
4546
expect(group.checks()[5].checkState()).toBe(CheckState.success);
47+
expect(group.checks()[6].checkState()).toBe(CheckState.success);
4648
});
4749

4850
it('checks fail correctly', async () => {
@@ -51,6 +53,7 @@ describe('Security Check Groups', () => {
5153
config.allowClientClassCreation = true;
5254
config.enableInsecureAuthAdapters = true;
5355
config.graphQLPublicIntrospection = true;
56+
config.mountPlayground = true;
5457
await reconfigureServer(config);
5558

5659
const group = new CheckGroupServerConfig();
@@ -60,6 +63,7 @@ describe('Security Check Groups', () => {
6063
expect(group.checks()[2].checkState()).toBe(CheckState.fail);
6164
expect(group.checks()[4].checkState()).toBe(CheckState.fail);
6265
expect(group.checks()[5].checkState()).toBe(CheckState.fail);
66+
expect(group.checks()[6].checkState()).toBe(CheckState.fail);
6367
});
6468

6569
it_only_db('mongo')('checks succeed correctly (MongoDB specific)', async () => {
@@ -69,7 +73,7 @@ describe('Security Check Groups', () => {
6973

7074
const group = new CheckGroupServerConfig();
7175
await group.run();
72-
expect(group.checks()[6].checkState()).toBe(CheckState.success);
76+
expect(group.checks()[7].checkState()).toBe(CheckState.success);
7377
});
7478

7579
it_only_db('mongo')('checks fail correctly (MongoDB specific)', async () => {
@@ -79,7 +83,7 @@ describe('Security Check Groups', () => {
7983

8084
const group = new CheckGroupServerConfig();
8185
await group.run();
82-
expect(group.checks()[6].checkState()).toBe(CheckState.fail);
86+
expect(group.checks()[7].checkState()).toBe(CheckState.fail);
8387
});
8488
});
8589

src/Options/Definitions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ module.exports.ParseServerOptions = {
404404
},
405405
mountPlayground: {
406406
env: 'PARSE_SERVER_MOUNT_PLAYGROUND',
407-
help: 'Mounts the GraphQL Playground - never use this option in production',
407+
help: 'Mounts the GraphQL Playground which exposes the master key in the browser - never use this option in production',
408408
action: parsers.booleanParser,
409409
default: false,
410410
},

src/Options/docs.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Options/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ export interface ParseServerOptions {
339339
:ENV: PARSE_SERVER_GRAPHQL_PUBLIC_INTROSPECTION
340340
:DEFAULT: false */
341341
graphQLPublicIntrospection: ?boolean;
342-
/* Mounts the GraphQL Playground - never use this option in production
342+
/* Mounts the GraphQL Playground which exposes the master key in the browser - never use this option in production
343343
:ENV: PARSE_SERVER_MOUNT_PLAYGROUND
344344
:DEFAULT: false */
345345
mountPlayground: ?boolean;

src/ParseServer.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,9 @@ class ParseServer {
458458

459459
if (options.mountPlayground) {
460460
parseGraphQLServer.applyPlayground(app);
461+
logging.getLogger().warn(
462+
'GraphQL Playground is enabled and exposes the master key in the browser. The playground is a developer tool and should not be used in production. Use Parse Dashboard for production environments.'
463+
);
461464
}
462465
}
463466
const server = await new Promise(resolve => {

src/Security/CheckGroups/CheckGroupServerConfig.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,18 @@ class CheckGroupServerConfig extends CheckGroup {
9090
}
9191
},
9292
}),
93+
new Check({
94+
title: 'GraphQL Playground disabled',
95+
warning:
96+
'GraphQL Playground is enabled and exposes the master key in the browser page.',
97+
solution:
98+
"Change Parse Server configuration to 'mountPlayground: false'. Use Parse Dashboard for GraphQL exploration in production.",
99+
check: () => {
100+
if (config.mountPlayground) {
101+
throw 1;
102+
}
103+
},
104+
}),
93105
new Check({
94106
title: 'Public database explain disabled',
95107
warning:

0 commit comments

Comments
 (0)