Subscribe to the Non-Human & AI Identity Journal

GraphQL schema

A GraphQL schema is the typed description of the data an API exposes, including object types, fields, and relationships. For AI agents, it is more than documentation because it shapes what the caller can discover, combine, and infer at runtime. That makes schema design part of the access control conversation.

Expanded Definition

A GraphQL schema is the contract that defines which object types, fields, arguments, and relationships a client can query or mutate. In API security and NHI operations, that contract is operational because it controls discovery, traversal, and the shape of data an agent can assemble at runtime. The GraphQL spec describes schemas as the core type system of a service, and that makes schema review part of the access control conversation, not just developer documentation.

For AI agents and other non-human identities, the schema can expose far more context than a single endpoint-based API because it invites recursive querying and field chaining. That is useful for automation, but it also increases the blast radius of overbroad field exposure, permissive introspection, or weak mutation boundaries. Definitions vary across vendors on how much schema hardening belongs to the application layer versus the gateway layer, so teams should treat the schema as one control plane among several, not as a complete security boundary. The most common misapplication is assuming the schema is only a developer aid, which occurs when security teams fail to review field-level exposure before granting agent access.

NIST Cybersecurity Framework 2.0 is useful here because schema governance maps naturally to access control, change management, and monitoring expectations.

Examples and Use Cases

Implementing GraphQL schema governance rigorously often introduces design friction, requiring organisations to balance agent flexibility against tighter review of every field, resolver, and mutation.

  • An AI agent queries a customer profile schema to pull account status, billing history, and support tickets in one call, which is efficient but requires field-level authorization checks.
  • A service account uses introspection to enumerate the schema and discover sensitive admin-only mutations, showing why schema visibility must be controlled before broad agent deployment.
  • A platform team splits a large schema into domains so that an internal agent can access inventory objects without inheriting finance or identity objects, reducing accidental overreach.
  • A security engineer compares the published schema against the actual resolver behavior and finds a field that returns more data than its name suggests, a common source of hidden exposure.

These use cases align with the operational guidance in the Ultimate Guide to NHIs, which emphasizes visibility, lifecycle control, and privilege reduction for machine identities. They also fit the control-oriented approach in NIST Cybersecurity Framework 2.0, where access, governance, and detection are treated as connected functions rather than isolated tasks.

Why It Matters in NHI Security

Schema design matters because many NHI incidents are not caused by a broken login flow but by an identity that can discover too much, ask for too much, or combine too much once inside an API. The Ultimate Guide to NHIs reports that 97% of NHIs carry excessive privileges, which shows how often machine access exceeds what is actually required. A permissive GraphQL schema can amplify that problem by making sensitive fields easy to enumerate and automate, especially when RBAC is coarse and JIT controls are absent.

For practitioners, the key issue is that schema risk often hides in plain sight: introspection, nested relationships, and flexible queries can become a data exfiltration path if they are not paired with policy enforcement, logging, and least privilege. That is why schema review should be part of Zero Trust Architecture thinking, not only API design. In NHI security terms, the schema becomes another place where ZSP can fail if an agent retains standing access to data it does not need. Organisations typically encounter this consequence only after an agent reads or mutates data it should not have touched, at which point schema governance becomes operationally unavoidable to address.

Standards & Framework Alignment

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

OWASP Non-Human Identity Top 10 address the attack and risk surface, while NIST Zero Trust (SP 800-207) and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
OWASP Non-Human Identity Top 10 NHI-02 Covers overbroad machine access and exposure through API paths and secrets handling.
NIST Zero Trust (SP 800-207) AC-3 Zero Trust requires explicit, least-privilege access even for service-to-service queries.
NIST CSF 2.0 PR.AC-4 Access permissions management applies directly to schema-driven data exposure.

Review schema-exposed fields against NHI-02 and remove any data paths an agent does not need.