Deployment#
Before deploying your GraphQL app to production you should disable GraphiQL
and Introspection
.
Why are they a problem?#
They can reveal sensitive information (e.g. internal business logic)
They make it easier for malicious parties to reverse engineer your GraphQL API
How to disable them#
GraphiQL#
GraphiQL is useful during testing and development but should be disabled in production by default.
It can be turned off by setting the graphiql
option to False
See the Strawberry Options documentation for the integration you are using for more information on how to disable it:
Introspection#
Introspection should primarily be used as a discovery and diagnostic tool for testing and development, and should be disabled in production by default.
You can disable introspection by adding a validation rule extension.
Other considerations#
Query depth#
You may also want to limit the query depth of GraphQL operations, which can be done via an extension
More resources#
See the documentation for the integration you are using for more information on deployment:
The docs for ASGI and Starlette do not provide an official deployment guide, but you may find the documentation for other frameworks that use ASGI servers useful (e.g. FastAPI)