Skip to content

Commit ab8dd54

Browse files
authored
fix: Revert accidental breaking default values for query complexity limits (#10205)
1 parent f06601c commit ab8dd54

File tree

5 files changed

+42
-35
lines changed

5 files changed

+42
-35
lines changed

spec/RequestComplexity.spec.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,23 +136,23 @@ describe('request complexity', () => {
136136
});
137137
const config = Config.get('test');
138138
expect(config.requestComplexity.includeDepth).toBe(3);
139-
expect(config.requestComplexity.includeCount).toBe(50);
140-
expect(config.requestComplexity.subqueryDepth).toBe(5);
139+
expect(config.requestComplexity.includeCount).toBe(-1);
140+
expect(config.requestComplexity.subqueryDepth).toBe(-1);
141141
expect(config.requestComplexity.queryDepth).toBe(-1);
142-
expect(config.requestComplexity.graphQLDepth).toBe(50);
143-
expect(config.requestComplexity.graphQLFields).toBe(200);
142+
expect(config.requestComplexity.graphQLDepth).toBe(-1);
143+
expect(config.requestComplexity.graphQLFields).toBe(-1);
144144
});
145145

146146
it('should apply full defaults when not configured', async () => {
147147
await reconfigureServer({});
148148
const config = Config.get('test');
149149
expect(config.requestComplexity).toEqual({
150-
includeDepth: 5,
151-
includeCount: 50,
152-
subqueryDepth: 5,
150+
includeDepth: -1,
151+
includeCount: -1,
152+
subqueryDepth: -1,
153153
queryDepth: -1,
154-
graphQLDepth: 50,
155-
graphQLFields: 200,
154+
graphQLDepth: -1,
155+
graphQLFields: -1,
156156
});
157157
});
158158
});

spec/SecurityCheckGroups.spec.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,14 @@ describe('Security Check Groups', () => {
3737
config.mountPlayground = false;
3838
config.readOnlyMasterKey = 'someReadOnlyMasterKey';
3939
config.readOnlyMasterKeyIps = ['127.0.0.1', '::1'];
40-
config.requestComplexity = { queryDepth: 10 };
40+
config.requestComplexity = {
41+
includeDepth: 5,
42+
includeCount: 50,
43+
subqueryDepth: 5,
44+
queryDepth: 10,
45+
graphQLDepth: 50,
46+
graphQLFields: 200,
47+
};
4148
await reconfigureServer(config);
4249

4350
const group = new CheckGroupServerConfig();

src/Options/Definitions.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -670,27 +670,27 @@ module.exports.RateLimitOptions = {
670670
module.exports.RequestComplexityOptions = {
671671
graphQLDepth: {
672672
env: 'PARSE_SERVER_REQUEST_COMPLEXITY_GRAPHQL_DEPTH',
673-
help: 'Maximum depth of GraphQL field selections. Set to `-1` to disable. Default is `50`.',
673+
help: 'Maximum depth of GraphQL field selections. Set to `-1` to disable. Default is `-1`.',
674674
action: parsers.numberParser('graphQLDepth'),
675-
default: 50,
675+
default: -1,
676676
},
677677
graphQLFields: {
678678
env: 'PARSE_SERVER_REQUEST_COMPLEXITY_GRAPHQL_FIELDS',
679-
help: 'Maximum number of field selections in a GraphQL query. Set to `-1` to disable. Default is `200`.',
679+
help: 'Maximum number of field selections in a GraphQL query. Set to `-1` to disable. Default is `-1`.',
680680
action: parsers.numberParser('graphQLFields'),
681-
default: 200,
681+
default: -1,
682682
},
683683
includeCount: {
684684
env: 'PARSE_SERVER_REQUEST_COMPLEXITY_INCLUDE_COUNT',
685-
help: 'Maximum number of include paths in a single query. Set to `-1` to disable. Default is `50`.',
685+
help: 'Maximum number of include paths in a single query. Set to `-1` to disable. Default is `-1`.',
686686
action: parsers.numberParser('includeCount'),
687-
default: 50,
687+
default: -1,
688688
},
689689
includeDepth: {
690690
env: 'PARSE_SERVER_REQUEST_COMPLEXITY_INCLUDE_DEPTH',
691-
help: 'Maximum depth of include pointer chains (e.g. `a.b.c` = depth 3). Set to `-1` to disable. Default is `5`.',
691+
help: 'Maximum depth of include pointer chains (e.g. `a.b.c` = depth 3). Set to `-1` to disable. Default is `-1`.',
692692
action: parsers.numberParser('includeDepth'),
693-
default: 5,
693+
default: -1,
694694
},
695695
queryDepth: {
696696
env: 'PARSE_SERVER_REQUEST_COMPLEXITY_QUERY_DEPTH',
@@ -700,9 +700,9 @@ module.exports.RequestComplexityOptions = {
700700
},
701701
subqueryDepth: {
702702
env: 'PARSE_SERVER_REQUEST_COMPLEXITY_SUBQUERY_DEPTH',
703-
help: 'Maximum nesting depth of `$inQuery`, `$notInQuery`, `$select`, `$dontSelect` subqueries. Set to `-1` to disable. Default is `5`.',
703+
help: 'Maximum nesting depth of `$inQuery`, `$notInQuery`, `$select`, `$dontSelect` subqueries. Set to `-1` to disable. Default is `-1`.',
704704
action: parsers.numberParser('subqueryDepth'),
705-
default: 5,
705+
default: -1,
706706
},
707707
};
708708
module.exports.SecurityOptions = {

src/Options/docs.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Options/index.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -425,25 +425,25 @@ export interface RateLimitOptions {
425425
}
426426

427427
export interface RequestComplexityOptions {
428-
/* Maximum depth of include pointer chains (e.g. `a.b.c` = depth 3). Set to `-1` to disable. Default is `5`.
429-
:DEFAULT: 5 */
428+
/* Maximum depth of include pointer chains (e.g. `a.b.c` = depth 3). Set to `-1` to disable. Default is `-1`.
429+
:DEFAULT: -1 */
430430
includeDepth: ?number;
431-
/* Maximum number of include paths in a single query. Set to `-1` to disable. Default is `50`.
432-
:DEFAULT: 50 */
431+
/* Maximum number of include paths in a single query. Set to `-1` to disable. Default is `-1`.
432+
:DEFAULT: -1 */
433433
includeCount: ?number;
434-
/* Maximum nesting depth of `$inQuery`, `$notInQuery`, `$select`, `$dontSelect` subqueries. Set to `-1` to disable. Default is `5`.
435-
:DEFAULT: 5 */
434+
/* Maximum nesting depth of `$inQuery`, `$notInQuery`, `$select`, `$dontSelect` subqueries. Set to `-1` to disable. Default is `-1`.
435+
:DEFAULT: -1 */
436436
subqueryDepth: ?number;
437437
/* Maximum nesting depth of `$or`, `$and`, `$nor` query operators. Set to `-1` to disable. Default is `-1`.
438438
:DEFAULT: -1 */
439439
queryDepth: ?number;
440-
/* Maximum depth of GraphQL field selections. Set to `-1` to disable. Default is `50`.
440+
/* Maximum depth of GraphQL field selections. Set to `-1` to disable. Default is `-1`.
441441
:ENV: PARSE_SERVER_REQUEST_COMPLEXITY_GRAPHQL_DEPTH
442-
:DEFAULT: 50 */
442+
:DEFAULT: -1 */
443443
graphQLDepth: ?number;
444-
/* Maximum number of field selections in a GraphQL query. Set to `-1` to disable. Default is `200`.
444+
/* Maximum number of field selections in a GraphQL query. Set to `-1` to disable. Default is `-1`.
445445
:ENV: PARSE_SERVER_REQUEST_COMPLEXITY_GRAPHQL_FIELDS
446-
:DEFAULT: 200 */
446+
:DEFAULT: -1 */
447447
graphQLFields: ?number;
448448
}
449449

0 commit comments

Comments
 (0)