Problem
src/graphql/plugins.ts wires depthLimit(MAX_DEPTH) and a query-complexity plugin into the GraphQL server (src/graphql/index.ts), which is good, but MAX_DEPTH and the complexity ceiling are hardcoded constants and there are no tests proving that oversized queries are actually rejected. These limits are the primary defense against expensive/abusive GraphQL queries, so they need to be tunable per environment and verified.
What needs to be done
- Read the depth limit and complexity ceiling from environment variables with the current values as defaults.
- Document the variables in
.env.example and the README.
- Add tests that submit a query exceeding the depth limit and one exceeding the complexity limit and assert both are rejected with a clear error.
- Add a test that a normal query within limits succeeds.
Files
src/graphql/plugins.ts, src/graphql/index.ts
.env.example, README.md
Acceptance deliverables
- Depth and complexity limits are configurable via env with safe defaults.
- Oversized queries are provably rejected.
- All CI checks pass; the change cannot be merged until CI is green.
Tests to pass
- Test: a query deeper than the limit is rejected.
- Test: a query above the complexity ceiling is rejected.
- Test: a valid query within limits succeeds.
Problem
src/graphql/plugins.tswiresdepthLimit(MAX_DEPTH)and a query-complexity plugin into the GraphQL server (src/graphql/index.ts), which is good, butMAX_DEPTHand the complexity ceiling are hardcoded constants and there are no tests proving that oversized queries are actually rejected. These limits are the primary defense against expensive/abusive GraphQL queries, so they need to be tunable per environment and verified.What needs to be done
.env.exampleand the README.Files
src/graphql/plugins.ts,src/graphql/index.ts.env.example,README.mdAcceptance deliverables
Tests to pass