← All articlesWeb security

How to disable GraphQL introspection in production and preserve client compatibility

Before releasing a configuration change that disables GraphQL introspection, a service owner needs two independent results: the configured policy for exposing the schema is enforced, and the normal operations of the clients in use retain their expected behavior. This article covers configuration preparation and acceptance testing using an entirely fictional book catalog. All checks are intended for your own test environment with production settings and synthetic data. Examining third-party APIs, discovering unknown fields, and bypassing restrictions are outside this plan.

Define the scope of the change

OWASP recommends disabling introspection throughout the system in production or publicly accessible environments. A separate recommendation covers GraphiQL and similar schema exploration tools: these should also be disabled. The release plan should therefore identify the introspection setting and the interface setting separately, if the interface was in use.

The trust boundary here lies between a client request and the schema information returned to that client. Disabling introspection does not replace authorization: a user's permission to read or modify the requested data must be checked independently. In the proposed acceptance tests, test users retain their existing permissions so that the comparison reflects the configuration change rather than a change in access.

Choose the mechanism for your implementation

The method for disabling introspection depends on the GraphQL server. Consult the documentation for your implementation and apply the appropriate mechanism in your own test environment with production settings. A configuration parameter alone is not observable confirmation of the result: a separate behavior check is required after the change.

In OWASP's Java example, schema field visibility is configured through NoIntrospectionGraphqlFieldVisibility.NO_INTROSPECTION_FIELD_VISIBILITY. This identifier cannot be carried over to another stack as a universal switch. When changing implementations, identify the appropriate setting again and repeat acceptance testing. Also consider disabling field name suggestions: OWASP recommends this when introspection is disabled, but not all implementations support the corresponding setting.

Prepare your own data and a client baseline

Consider an entirely fictional web product called ‘Bookshelf.’ Its own test schema has known operations for retrieving a book and changing its title. Create a synthetic record, book-test-17, titled ‘The Garden on a Cloud,’ and a test user permitted to perform both operations. No real user records are needed for this example.

Before changing the configuration, run these operations through the clients in use. Record the client list, variables, user permissions, expected fields and values, and the record's initial state. For the update operation, set the title to ‘The Moon in a Binding’ and confirm it with a separate read. Restore the catalog's initial state before running the tests again. This ensures that the before-and-after comparison uses the same conditions.

Choose operations from scenarios actually used in your product. If you test only retrieving a book's details and renaming it, the result does not automatically apply to other operations or clients.

Obtain two independent acceptance results

The following plan consists of original editorial acceptance tests, not an official OWASP procedure. First, check the policy for exposing the schema: after enabling the setting, run a prepared introspection check only in your own environment. The acceptance criterion is that the request is rejected and no schema description is returned. Inspect the response content; this plan does not specify a universal HTTP status code for all implementations. The query text for retrieving the schema is not included in this plan.

Next, repeat the known normal operations through each selected client using the same variables and permissions. The read should return record book-test-17 with the expected values. After renaming, a separate read should show ‘The Moon in a Binding,’ and the user scenario should complete. A successful HTTP response alone does not confirm that the data change was applied.

Keep the results separate. A rejected introspection request does not confirm client compatibility, and a working book details view does not prove that the restriction is enforced. If any expected result is missing, the corresponding part has failed acceptance testing; correct the configuration or identified incompatibility and repeat the affected checks.

Verify separately that GraphiQL is disabled

If GraphiQL was enabled, record the known address of your own interface in advance. After changing the setting, open that exact address in the test environment and confirm that a functioning GraphiQL interface is no longer provided. This check does not require searching for other addresses or examining unknown APIs. An HTTP status alone is also no substitute for checking whether the interface itself is available.

Then perform an authorized normal operation through a client in use and compare the data with the baseline. This is a separate proposed editorial test: disabling the schema exploration tool must be confirmed independently of restricting introspection and preserving client scenarios.

Document priorities and the limits of the result

For the release, first confirm that the introspection policy is enforced and that the selected clients remain compatible. If GraphiQL was in use, confirm separately that it is disabled. Then document the decision on field name suggestions based on the implementation's capabilities. If a setting is unsupported, explicitly record that limitation rather than assuming it is effective.

The test result applies to the specific configuration, clients, operations, and permissions tested with the prepared data. It does not guarantee the security of the entire API or compatibility with untested scenarios. If the server changes, the configuration mechanism must be checked again, and authorization remains a separate requirement. If you need help assessing your own service, you can request a free audit of your website or the web portion of your product.

Sources and documentation

  1. GraphQL Cheat Sheet
  2. Error Handling Cheat Sheet
CheckMyApp

Check your application’s security.

Enter your web application address and email. Get a free preliminary report and choose the depth of analysis.

Check for free