GraphQL Query Complexity and Schema Security Auditor
Paste an SDL schema or introspection JSON and a query to see per-field cost, depth and list multipliers, plus a scored audit of risky schema design.
Runs in your browser. Your files never leave your device. See how to check
…
How to do it
- 1Add the schema
Paste SDL or open an introspection JSON file.
- 2Paste a query
Include fragments; variables may stay as $names.
- 3Set the cost model
Choose the assumed list size, field costs and limits.
- 4Read the result
Check cost, depth and the per-field table, and fix errors.
- 5Audit the schema
Open Schema audit to see risky lists, cycles and exposed fields.
- 6Enforce limits
Copy the server rule example and download the reports.
About this tool
GraphQL lets clients ask for exactly the data they need, which also means a single request can ask for far more than the server can afford. A query that follows product to reviews to author to reviews again multiplies the work at every list, and without limits one request can fan out into millions of resolver calls. Defending against this starts with understanding the cost of real queries and the shape of the schema. This auditor parses your schema from SDL or an introspection result, parses a query with its fragments, and walks it the way a cost analysis rule does: each field is checked against the schema, list fields multiply the cost of everything below them by the first or limit argument (or an assumed size you choose), and the tool reports the total cost, the maximum depth and a table of every field with its multiplier. A separate schema audit lists unpaginated list fields, circular type relationships that allow unlimited nesting, secret-looking field names and missing cost directives, and turns them into a score.
Cost model
Each object field costs the object cost you set (default 1) and each scalar field costs the scalar cost (default 0), multiplied by the product of list sizes above it. List sizes come from the first, last, limit, pageSize, take, count or perPage argument when it is a literal number. When the argument is a variable or missing, the assumed list size is used. The query passes when cost and depth stay under your limits; both turn red otherwise.
Validation
Unknown fields, missing selection sets on object fields, unknown fragments and fragment cycles are reported with line numbers. Introspection fields (__schema and __type) are listed with a note.
Schema audit
List fields that return objects without a pagination argument are high risk on the root query type and medium elsewhere. Pagination arguments without defaults are noted. Pairs of types that reference each other, and types that reference themselves, are listed as circular because they enable deep queries. Fields named like passwords, tokens or keys are high risk. Mutations that take a free-text query or filter argument get a validation reminder. If no cost, complexity or rate-limit directive is declared, the audit reminds you that limits must be enforced in server middleware.
Server limits
The third tab writes example validation rules for a Node GraphQL server using your chosen depth and cost limits, with introspection switched off in production.
Limits
The cost model is an estimate, not a measurement of your resolvers, and every server weights fields differently. Interfaces and unions are resolved by fragment type only, and directives such as @include are not evaluated. The tool never sends queries to an endpoint.
Worked example
A shop schema with Product, Review and User types was audited. The product page query asked for reviews(first: 20), each review's author, that author's reviews, and each of those reviews' product name, plus related products and their sellers. With an assumed list size of 10, the tool counted 16 fields, depth 6 and cost 253, driven by the 200 product lookups under author reviews. The schema audit scored 37: Query.users and User.reviews had no pagination, User.passwordHash was exposed, and three circular links (Product and Review, Review and User, Product to itself) allowed unlimited nesting.
Quick facts
- Category: Security & Privacy
- Works in your browser, no sign-up, no upload.
- Your input stays on your device.
- Available in English.
- Content last reviewed:
- Official source: GraphQL Specification (October 2021) and OWASP GraphQL Cheat Sheet
Frequently asked questions
What is query depth?
The number of nested selection levels from the root field to the deepest leaf. A depth limit, often 7 to 10, blocks queries that nest circular types many times.
Why does the cost grow so fast?
Every list multiplies what is below it. 20 reviews each with 10 more reviews each with a product is 200 product lookups, even though the query text is short.
Should I disable introspection?
For private APIs, usually yes in production, because it hands an attacker a full map of the schema. Public APIs often keep it on and rely on cost limits instead.
Can I paste an introspection result?
Yes. Paste the JSON from an introspection query and it is converted to SDL automatically.
Are persisted queries a replacement for limits?
They help a lot because the server only runs known queries, but depth and cost limits are still worth having for any operation that accepts arbitrary queries.
Does the tool contact my GraphQL server?
No. It works only on the text you paste, inside your browser.
