Skip to main content
MediumAPIOWASP A05:2021CWE-489

How to fix: GraphQL IDE served in production

This endpoint serves an interactive GraphQL IDE: a schema browser and a query editor for this API. GraphiQL, GraphQL Playground, Apollo Sandbox, Voyager and the Hasura console are all development tools, and every one of them is meant to be switched off outside development.

Why it matters

The IDE gives anyone who finds the endpoint a full schema browser plus a request builder pointed at your production API, with your visitor's own cookies attached. Enumerating the write surface, discovering fields the frontend never calls, and iterating on an authorization bypass all stop needing any tooling of the attacker's own.

The detector matches structural markers only: the IDE's own bundle filename, its document title, or the function that renders it (GraphiQL.createFetcher, renderGraphiQL, ApolloServerPluginLandingPage). A page that mentions these products in prose does not match, so documentation and marketing pages do not fire it. Note that serving the IDE and enabling introspection are separate switches: turning off one does not turn off the other.

How to fix it

  1. 1Disable the IDE plugin in production. In Apollo Server, pass ApolloServerPluginLandingPageDisabled() rather than relying on NODE_ENV alone.
  2. 2In express-graphql / graphql-http, set graphiql to false when the environment is not development.
  3. 3For Hasura, do not deploy with HASURA_GRAPHQL_ENABLE_CONSOLE=true; run the console locally against the remote endpoint instead.
  4. 4Disable schema introspection at the same time, since the IDE and introspection are controlled independently.

Code examples

Apollo Server: disable the landing page in production

TypeScript
import {
  ApolloServerPluginLandingPageDisabled,
  ApolloServerPluginLandingPageLocalDefault,
} from '@apollo/server/plugin/landingPage/default';

const isProd = process.env.NODE_ENV === 'production';

new ApolloServer({
  schema,
  introspection: !isProd,
  plugins: [
    isProd
      ? ApolloServerPluginLandingPageDisabled()
      : ApolloServerPluginLandingPageLocalDefault(),
  ],
});

graphql-http: gate GraphiQL on the environment

JavaScript
app.all(
  '/graphql',
  createHandler({
    schema,
    graphiql: process.env.NODE_ENV !== 'production',
  }),
);

References

Detected automatically by VulnRadar. The check id is api-graphql-ide-exposed, stable across every scan so you can filter or diff on it.

See every api check

Questions

How severe is GraphQL IDE served 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-ide-exposed, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does GraphQL IDE served in production map to?
It maps to CWE-489. 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.

Propose a checkHow a check is built

Scan your own site for graphql ide served in production

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

How to fix: GraphQL IDE served in production | VulnRadar