You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be helpful if the library included a validation rule that would throw when an introspection field is requested. Something like what Apollo Server already uses:
const NoIntrospection = (context: ValidationContext) => ({
Field(node: FieldDefinitionNode) {
if (node.name.value === '__schema' || node.name.value === '__type') {
context.reportError(
new GraphQLError(
'GraphQL introspection is not allowed by Apollo Server, but the query contained __schema or __type. To enable introspection, pass introspection: true to ApolloServer in production',
[node],
),
);
}
},
});
The validation rule could then be optionally added when using libraries like express-graphql to effectively disable introspection.
The text was updated successfully, but these errors were encountered:
It would be helpful if the library included a validation rule that would throw when an introspection field is requested. Something like what Apollo Server already uses:
The validation rule could then be optionally added when using libraries like
express-graphql
to effectively disable introspection.The text was updated successfully, but these errors were encountered: