GraphQL APIs with introspection on and no depth or cost limits

Last updated November 14, 2026
Steps
- Find your GraphQL server setup (Apollo Server, GraphQL Yoga, a Next.js route handler or a hosted GraphQL backend) and check whether introspection and GraphiQL or Sandbox are enabled in production.
- Turn introspection off in production unless the API is meant for outside developers. In Apollo Server, introspection is on by default unless NODE_ENV is production, so check for an explicit introspection: true left over from development.
- Turn off stack traces in error responses (in Apollo Server, includeStacktraceInErrorResponses: false) and mask internal error messages.
- Add a query depth limit and limits on list sizes (for example a maximum for first or limit arguments), and paginate every list field.
- Add query cost or complexity limits and a server timeout so one expensive query cannot hog the database.
- Limit batching: cap how many operations or aliases one request may contain, and block batching on sensitive fields like login, password reset or one-time codes.
- Check authorization inside each resolver (and on node or nodes lookups by ID), not only at the gateway, so a nested field cannot return another user’s data.
- Retest with a deliberately deep nested query and an aliased batch of the same field; both should be rejected with a generic error.
Why it matters
OWASP’s GraphQL Cheat Sheet says expensive queries can cause denial of service and that depth and amount are unlimited by default unless you add limits. It recommends disabling introspection and GraphiQL in production or public environments, avoiding stack traces and debug mode, and applying access-control checks on both edges and nodes. It also describes batching attacks, where many queries or aliased lookups in a single request are used to enumerate objects or brute-force passwords and one-time codes, often slipping past rate limits that only count HTTP requests. OWASP’s API Security Top 10 ranks Unrestricted Resource Consumption as API4:2023. Apollo’s docs confirm introspection defaults to on unless NODE_ENV is production. This page is for reviewing your own API.
Sources
OWASP Cheat Sheet Series: GraphQL Cheat Sheet — https://cheatsheetseries.owasp.org/cheatsheets/GraphQL_Cheat_Sheet.html
OWASP API Security Top 10 2023: API4 Unrestricted Resource Consumption — https://owasp.org/API-Security/editions/2023/en/0xa4-unrestricted-resource-consumption/
GraphQL.org: Security — https://graphql.org/learn/security/
Apollo Server docs: ApolloServer options (introspection, includeStacktraceInErrorResponses) — https://www.apollographql.com/docs/apollo-server/api/apollo-server
Checked at the source on November 11, 2026.
Related patterns
- No rate limiting on login, signup or AI endpoints
- Error messages that leak stack traces, queries or keys
- Debug or preview mode left on in production
- IDOR in vibe-coded apps: changing an ID in the URL to see someone else's data
- API responses that return whole database records (excessive data exposure)
- Login and signup messages that reveal which accounts exist (account enumeration)
- Regex denial of service (ReDoS): one crafted input that freezes your app
- AI features anyone can use to run up your bill (unbounded consumption)
Found a problem you'd rather not fix yourself?
Tell us what's wrong. A StorenTech engineer reviews your app and replies with a fixed quote, so you know the cost before any work starts.
Get it fixed by StorenTechVibe Security Weekly
One email a week with new failure patterns and how to fix them.
By joining you agree we may email you this newsletter. See our privacy policy. Free. Unsubscribe anytime. We'll never sell your email.