How to fix: GraphQL batch (array) queries accepted
Accepting an array of queries lets a single HTTP request fan out to N independent operations, multiplying rate-limit cost and bypassing per-request throttles.
Why it matters
A single batched HTTP request containing 100 queries executes 100 independent resolver trees while consuming only 1 unit of any per-request rate limit: a cheap amplification attack that can exhaust database connections and CPU without triggering throttling.
Accepting an array of queries lets a single HTTP request fan out to N independent operations, multiplying rate-limit cost and bypassing per-request throttles.
How to fix it
- 1Disable batching if not required by clients
- 2If batching is needed, cap the array size (e.g., max 10 items) and charge each item against the rate-limit budget
- 3In Apollo Server: set allowBatchedHttpRequests: false in the HTTP handler options
Code examples
Apollo Server: disable batching
import { expressMiddleware } from '@apollo/server/express4';
app.use('/graphql', expressMiddleware(server, {
allowBatchedHttpRequests: false,
}));Custom batch size limit middleware
app.use('/graphql', (req, res, next) => {
if (Array.isArray(req.body) && req.body.length > 10) {
return res.status(400).json({
errors: [{ message: 'Batch size limit exceeded (max 10).' }],
});
}
next();
});References
Detected automatically by VulnRadar. The check id is api-graphql-batch-queries, stable across every scan so you can filter or diff on it.
More api checks
- LowTRACE method referenced in API response body
- InfoREST endpoint allows DELETE
- LowGraphQL introspection field suggestions
- MediumGraphQL endpoint has no rate-limit headers
- LowOpenAPI server URL leaks internal host
- LowCORS preflight result not cached
- HighBearer token in URL query string
- MediumJSONP callback parameter accepted
Questions
- How severe is GraphQL batch (array) queries accepted?
- VulnRadar rates this medium severity in the api category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id api-graphql-batch-queries, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does GraphQL batch (array) queries accepted map to?
- It maps to CWE-799. In the OWASP Top 10 it falls under A04:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.