Explore our new Cybersecurity Terms Glossary, explained by our experts.
Cybersecurity Terms Glossary
GraphQL security covers the risks created by letting clients compose their own queries: schema exposure, field-level authorisation gaps, and queries expensive enough to act as a denial of service.

What Is GraphQL Security?
GraphQL moves the decision about what data a response contains from the server to the client. That is the feature, and it is also the security problem. A single endpoint accepts arbitrary queries against a typed schema, so the controls that a REST design gets from having separate, individually protected URLs have to be rebuilt deliberately inside the resolver layer.
Introspection lets a client ask the server to describe every type, field, argument, and deprecation note it supports. Development tooling depends on it, and so does an attacker: a single query returns the complete shape of your data model, including fields that the user interface never requests. Tools such as graphql-voyager and clairvoyance turn the result into a diagram, and the latter can reconstruct much of a schema even when introspection is disabled, by abusing the suggestion feature that offers “did you mean” hints on misspelled field names.
Disabling introspection in production is sensible housekeeping. It is not a security control, because the schema is also visible in the client bundle and recoverable by brute force. Treat it as removing a convenience rather than closing a hole.
The most damaging GraphQL findings are ordinary access control failures that the architecture makes easy to miss. A resolver that returns a User object may be called from a dozen query paths, and a check written in one path does not apply to the others. Nested relationships make this worse: a query that starts at an object the caller legitimately owns can traverse to its author, then to that author’s other organisations, and arrive somewhere the caller should never reach.
The remedy is to enforce authorisation in the resolver for each field or type, not in the query handler, so every route to a field passes the same check. Where a field returns an identifier chosen by the client, the usual IDOR rules apply unchanged.
The mature answer is query cost analysis: assign a weight to each field, compute the cost of a document before executing it, and reject or charge for anything above a budget. GitHub’s GraphQL API publishes this model openly, with a limit of 5,000 points per hour and a documented formula for how connections are scored. Depth limits, complexity limits, pagination caps, and timeouts are the simpler controls that should be in place regardless, alongside rate limiting that counts operations rather than HTTP requests.
Testing needs tooling that understands the protocol. InQL and the GraphQL support in Burp Suite generate queries from the schema and make nested traversal practical to explore. The same principles that govern REST API security still apply underneath, and our web application security testing covers GraphQL endpoints against both.
Yes, as housekeeping, but do not count it as a defence. The schema is also present in your client-side bundle, and tools can reconstruct most of it from field suggestion hints even with introspection off. Disabling it raises the effort slightly. Authorisation checks in resolvers and cost limits are what actually protect the API.
No. The GraphQL layer parses the query document, but the resolvers underneath still talk to databases, search engines, and internal services. Any argument passed into a query string, a filter expression, or a command carries the same injection risk as it would in a REST handler. Parameterised queries and input validation remain necessary at that boundary.
Count operations and cost rather than HTTP requests, because one request may carry a batch of hundreds of operations and one query may cost far more than another. Assign a weight per field, compute the document cost before execution, and apply a budget per client over a time window. Cap pagination arguments and set an execution timeout as a backstop.
For first-party clients, usually yes. Registering an approved set of query documents and accepting only their hashes removes arbitrary query composition, which eliminates deep nesting, aliasing, and batching abuse in one step and reduces bandwidth. The trade-off is operational: the approved set has to be published with each client release, which suits controlled deployments better than public APIs.
You May Be Interested In These
We use a few cookies that are needed to make this website work, and they are always on. We would also like to set analytics cookies, to see which pages are useful; functional cookies, so that our live chat works; and advertising cookies, to measure our campaigns. We will not set any of those until you say yes, and you can change your mind at any time from the Cookie Settings link in the footer.
Choose the cookies you are happy for us to use. Strictly necessary cookies are always on; everything else is off until you turn it on.
These cookies keep the website working: they hold your security checks, your form submissions and the choice you make here. The site cannot run without them, so they are always on.
These let our live chat open and remember your conversation, and let the newsletter sign-up work. Switch them off and the chat window will not appear.
These tell us which pages are read and how people find us, so that we can improve the site. The reports are about groups of visitors, never about you personally.
These let us measure our advertising and show you our adverts on other websites, such as LinkedIn, Google and Meta. Switch them off and you will still see adverts, but they will be less relevant.