-
Notifications
You must be signed in to change notification settings - Fork 2k
fix: remove security vulnerability of exposing graph in production environment #3363
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
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a node specific fix. As suggested in that issue i think it would be better to have a Boolean configuration.
@@ -12,6 +12,10 @@ export function didYouMean( | |||
firstArg: string | ReadonlyArray<string>, | |||
secondArg?: ReadonlyArray<string>, | |||
) { | |||
if (process.env.NODE_ENV === 'production') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@saihaj Thanks for the review, I wonder if by default the library should enforce good practices so that we do not leave vulnerable code in production systems?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes but this isn’t a platform agnostic fix. This library can be used in non-node environments. So it is something in the environment you are implementing that this can be handled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood. Keen to see how this progress and I could help with the fix: #2247 (comment)
It shouldn't be a dev vs production configuration. Having global flags (though I want to keep #2247 as the single discussion for discussing solutions so closing this one. |
Resolves and related to:
#3229
#2247
Following Node.js best practices of setting NODE_ENV=production we could use the same pattern to disable this security vulnerability in graphql-js at the core.
Open for feedback to resolve this issue ASAP