Join our Newsletter — 33% off our NHI Course
Home› Glossary› Cyber Security› Persisted GraphQL Query
Cyber Security

Persisted GraphQL Query

← Back to Glossary
By NHI Mgmt Group Updated October 31, 2026 Domain: Cyber Security

A persisted GraphQL query is a pre-registered query that the client references with a unique identifier instead of sending the full query text. This approach can reduce payload size, improve caching, and narrow the set of executable queries, but it still requires security testing for validation and authorization weaknesses.

What persisted GraphQL queries change

Persisted GraphQL queries shift the client from sending arbitrary query text to referencing a known query by identifier. That changes the security posture in two ways: it narrows the executable query surface, and it moves governance toward a smaller set of approved operations that can be reviewed, cached, and monitored more consistently.

This does not make GraphQL safe by default. The identifier still resolves to a real resolver path, so validation, field-level authorization, and resolver behaviour remain part of the trust boundary.

Why they are used

The main operational value is control. When a client can only invoke pre-registered queries, organisations reduce the chance of ad hoc query abuse, limit unexpected schema traversal, and make performance more predictable. That is especially useful where GraphQL endpoints serve multiple clients with different data needs and where query shape strongly affects cost.

Persisted queries also support caching and versioning. A stable identifier is easier to cache than free-form text, and an allowlisted set of operations gives application teams a cleaner way to evolve clients without exposing the full query language on every request.

Security properties and limits

Persisted queries can reduce the risk of query injection style misuse, but they do not eliminate authorization defects. A persisted query can still request fields the caller should not see, and a poorly designed resolver can still over-return data or rely on weak object checks.

They also do not automatically prevent resource abuse. A registered query can still be expensive if it fans out across many nodes, traverses deep relationships, or is invoked at scale. Controls such as depth limits, cost analysis, batching rules, and rate limiting remain relevant, particularly in GraphQL services that must resist abuse of apparently legitimate operations.

For secure operation, the key question is not whether the query is persisted, but whether the server validates the request, authorizes the caller at the right layer, and keeps the allowed operation set tight enough to match business need.

How organisations use them well

Persisted queries work best when the registration process is treated as a control point rather than a convenience feature. The approved query set should be reviewed for data exposure, resolver authorization, and operational cost before clients rely on it in production.

They are most effective when paired with broader GraphQL guardrails. NHIMG’s GraphQL Security Guide covers the surrounding controls that matter here, including introspection handling, query depth and cost limits, batching abuse, and resolver authorization.

Persisted queries also sit naturally alongside API abuse controls. The OWASP API Security Top 10 is useful because the same endpoint can still fail through broken authorisation or unrestricted resource consumption even when the query text itself is pre-registered.

Risk and Threat Considerations

Persisted queries reduce exposure, but they can create a false sense of safety if organisations assume the registration layer is equivalent to authorization. The biggest practical risk is that a known query becomes a trusted pathway into data that is still underprotected at the resolver, object, or business-logic level.

Failure mechanism: An attacker or careless client abuses an allowed operation, then relies on weak field checks, over-broad resolver access, or expensive query paths to retrieve more data or consume more resources than intended.

Impact: The result can be data exposure, broken authorisation, excessive backend load, or denial of service through a query that is legitimate in form but harmful in effect.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP API Security Top 10 addresses the attack and risk surface, while NIST SP 800-53 Rev 5 sets the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP API Security Top 10API4 — Unrestricted Resource ConsumptionGraphQL persisted queries can still be abused to consume excessive resources.
API1 — Broken Object Level AuthorizationPersisted queries still depend on object-level authorization inside the resolver path.
API5 — Broken Function Level AuthorizationA pre-registered query remains unsafe if callers can invoke functions they should not reach.
Recommendation — Apply API4 controls to cap query cost, rate, and execution impact. Enforce API1 checks so persisted operations cannot access unauthorised objects. Apply API5 controls to restrict which operations each caller may execute.
NIST SP 800-53 Rev 5AC-3 — Access EnforcementAccess decisions must still be enforced on the data and resolver paths behind the persisted query.
SI-10 — Information Input ValidationPersisted queries still require validation of operation structure and accepted parameters.
Recommendation — Enforce AC-3 at the resolver and object layers, not only at request registration. Apply SI-10 to validate requests, parameters, and operation inputs before execution.

Practitioner Guidance

Why practitioners should care: Persisted queries are a control boundary, not a complete security control. If you register queries without reviewing the resolver path and returned data, you may preserve all the risk of open GraphQL while losing some of the visibility that free-form text provides.

What to watch for: Review the allowlisted operations for excessive field reach, weak object-level checks, and query shapes that are cheap to register but expensive to execute. OWASP API Top 10 API4 Unrestricted Resource Consumption Guide is a useful companion when you are validating whether a persisted query can still drive cost or availability issues at scale.

Practitioner takeaway: Treat persisted queries as one layer in a broader GraphQL security model, then test the authorised operation set the same way you would test any other high-value API path.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on October 31, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org