Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to disable introspection #628

Closed
iamchathu opened this issue Apr 1, 2020 · 5 comments
Closed

How to disable introspection #628

iamchathu opened this issue Apr 1, 2020 · 5 comments

Comments

@iamchathu
Copy link

In Apollo server there is an option introspection: true to turn on and off graphql introspection. How to the same in GraphQL yoga?

@performautodev
Copy link

performautodev commented May 1, 2020

You can done this by :

const NoIntrospection = require("graphql-disable-introspection");

server.start(
{
validationRules: [NoIntrospection],
} );

export declare class GraphQLServer {
...
options: Options;
..
}

export interface Options extends ApolloServerOptions {
port?: number | string;
cors?: CorsOptions | false;
...
}

@iamchathu
Copy link
Author

@performautodev Typescript complains about the introspection field. Will check with it.

@omar-dulaimi
Copy link

There's no such "introspection" option in Yoga, I'm still looking around for ways to disable it. It seems that this project is no longer active. What about the many production projects out there depending on it? Open source should not be like this.

@omar-dulaimi
Copy link

I found a library that fix this issue: https://www.npmjs.com/package/graphql-disable-introspection

@saihaj saihaj mentioned this issue Dec 5, 2021
32 tasks
@saihaj
Copy link
Collaborator

saihaj commented Feb 19, 2022

hey @iamchathu @omar-dulaimi we @the-guild-org are the new maintainers of this project. We are actively developing v2. It is build on top of envelop and in the new version you can just pass in the disable introspection plugin.

import { createServer } from '@graphql-yoga/node'
import { useDisableIntrospection } from '@envelop/disable-introspection'
const server = createServer({
  schema,
  logging: false,
  plugins: [useDisableIntrospection()]
})

Would love to get your feedback on beta release!

@saihaj saihaj closed this as completed Feb 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants