Skip to content

Commit f403131

Browse files
authored
refactor: Deprecate disabled default values for query complexity limits (#10207)
1 parent 2b28587 commit f403131

3 files changed

Lines changed: 82 additions & 0 deletions

File tree

DEPRECATIONS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ The following is a list of deprecations, according to the [Deprecation Policy](h
2121
| DEPPS15 | Config option `readOnlyMasterKeyIps` defaults to `['127.0.0.1', '::1']` | [#10115](https://github.com/parse-community/parse-server/pull/10115) | 9.5.0 (2026) | 10.0.0 (2027) | deprecated | - |
2222
| DEPPS16 | Remove config option `mountPlayground` | [#10110](https://github.com/parse-community/parse-server/issues/10110) | 9.5.0 (2026) | 10.0.0 (2027) | deprecated | - |
2323
| DEPPS17 | Remove config option `playgroundPath` | [#10110](https://github.com/parse-community/parse-server/issues/10110) | 9.5.0 (2026) | 10.0.0 (2027) | deprecated | - |
24+
| DEPPS18 | Config option `requestComplexity` limits enabled by default | [#10207](https://github.com/parse-community/parse-server/pull/10207) | 9.6.0 (2026) | 10.0.0 (2027) | deprecated | - |
2425

2526
[i_deprecation]: ## "The version and date of the deprecation."
2627
[i_change]: ## "The version and date of the planned change."

spec/Deprecator.spec.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,55 @@ describe('Deprecator', () => {
149149
})
150150
);
151151
});
152+
153+
it('logs deprecation for requestComplexity limits when not set', async () => {
154+
const logSpy = spyOn(Deprecator, '_logOption').and.callFake(() => {});
155+
156+
await reconfigureServer();
157+
const keys = [
158+
'requestComplexity.includeDepth',
159+
'requestComplexity.includeCount',
160+
'requestComplexity.subqueryDepth',
161+
'requestComplexity.queryDepth',
162+
'requestComplexity.graphQLDepth',
163+
'requestComplexity.graphQLFields',
164+
];
165+
for (const key of keys) {
166+
expect(logSpy).toHaveBeenCalledWith(
167+
jasmine.objectContaining({
168+
optionKey: key,
169+
})
170+
);
171+
}
172+
});
173+
174+
it('does not log deprecation for requestComplexity limits when explicitly set', async () => {
175+
const logSpy = spyOn(Deprecator, '_logOption').and.callFake(() => {});
176+
177+
await reconfigureServer({
178+
requestComplexity: {
179+
includeDepth: 10,
180+
includeCount: 100,
181+
subqueryDepth: 10,
182+
queryDepth: 10,
183+
graphQLDepth: 20,
184+
graphQLFields: 200,
185+
},
186+
});
187+
const keys = [
188+
'requestComplexity.includeDepth',
189+
'requestComplexity.includeCount',
190+
'requestComplexity.subqueryDepth',
191+
'requestComplexity.queryDepth',
192+
'requestComplexity.graphQLDepth',
193+
'requestComplexity.graphQLFields',
194+
];
195+
for (const key of keys) {
196+
expect(logSpy).not.toHaveBeenCalledWith(
197+
jasmine.objectContaining({
198+
optionKey: key,
199+
})
200+
);
201+
}
202+
});
152203
});

src/Deprecator/Deprecations.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,34 @@ module.exports = [
4141
changeNewKey: '',
4242
solution: "Use Parse Dashboard as GraphQL IDE or configure a third-party GraphQL client such as Apollo Sandbox, GraphiQL, or Insomnia with custom request headers.",
4343
},
44+
{
45+
optionKey: 'requestComplexity.includeDepth',
46+
changeNewDefault: '10',
47+
solution: "Set 'requestComplexity.includeDepth' to a positive integer appropriate for your app to limit include pointer chain depth, or to '-1' to disable.",
48+
},
49+
{
50+
optionKey: 'requestComplexity.includeCount',
51+
changeNewDefault: '100',
52+
solution: "Set 'requestComplexity.includeCount' to a positive integer appropriate for your app to limit the number of include paths per query, or to '-1' to disable.",
53+
},
54+
{
55+
optionKey: 'requestComplexity.subqueryDepth',
56+
changeNewDefault: '10',
57+
solution: "Set 'requestComplexity.subqueryDepth' to a positive integer appropriate for your app to limit subquery nesting depth, or to '-1' to disable.",
58+
},
59+
{
60+
optionKey: 'requestComplexity.queryDepth',
61+
changeNewDefault: '10',
62+
solution: "Set 'requestComplexity.queryDepth' to a positive integer appropriate for your app to limit query condition nesting depth, or to '-1' to disable.",
63+
},
64+
{
65+
optionKey: 'requestComplexity.graphQLDepth',
66+
changeNewDefault: '20',
67+
solution: "Set 'requestComplexity.graphQLDepth' to a positive integer appropriate for your app to limit GraphQL field selection depth, or to '-1' to disable.",
68+
},
69+
{
70+
optionKey: 'requestComplexity.graphQLFields',
71+
changeNewDefault: '200',
72+
solution: "Set 'requestComplexity.graphQLFields' to a positive integer appropriate for your app to limit the number of GraphQL field selections, or to '-1' to disable.",
73+
},
4474
];

0 commit comments

Comments
 (0)