How to fix: GraphQL introspection enabled in production
__schema / __type queries dump the entire schema, including internal fields, admin-only mutations, and deprecation hints that aid targeted attacks.
Why it matters
Introspection in production gives attackers a complete blueprint of your data model: every type, field, mutation, and subscription, eliminating the recon phase and exposing internal-only operations that untrusted clients should never call.
__schema / __type queries dump the entire schema, including internal fields, admin-only mutations, and deprecation hints that aid targeted attacks.
How to fix it
- 1Disable introspection in production (Apollo: introspection: false, GraphQL.NET: ExposeMetadata = false)
- 2Allow introspection only for authenticated admin users if needed for internal tooling
- 3Use persisted queries to give clients what they need without exposing the full schema
Code examples
Apollo Server 4: disable introspection in production
import { ApolloServer } from '@apollo/server';
const server = new ApolloServer({
typeDefs,
resolvers,
introspection: process.env.NODE_ENV !== 'production',
});GraphQL Yoga: NoSchemaIntrospectionCustomRule
import { createYoga } from 'graphql-yoga';
import { NoSchemaIntrospectionCustomRule } from 'graphql';
const yoga = createYoga({
schema,
plugins: [
{
onValidate({ addValidationRule }) {
if (process.env.NODE_ENV === 'production') {
addValidationRule(NoSchemaIntrospectionCustomRule);
}
},
},
],
});References
Detected automatically by VulnRadar. The check id is api-graphql-introspection-enabled, stable across every scan so you can filter or diff on it.
More api checks
- LowTRACE method referenced in API response body
- InfoREST endpoint allows DELETE
- LowGraphQL introspection field suggestions
- MediumGraphQL endpoint has no rate-limit headers
- LowOpenAPI server URL leaks internal host
- LowCORS preflight result not cached
- HighBearer token in URL query string
- MediumJSONP callback parameter accepted
Questions
- How severe is GraphQL introspection enabled in production?
- VulnRadar rates this medium severity in the api category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id api-graphql-introspection-enabled, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does GraphQL introspection enabled in production map to?
- It maps to CWE-200. In the OWASP Top 10 it falls under A05:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.