-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Use reference-equality when omitting validation rules during composition. #3338
Merged
abernix
merged 2 commits into
master
from
abernix/filter-rules-on-reference-equality-rather-than-string-eq
Sep 27, 2019
Merged
Use reference-equality when omitting validation rules during composition. #3338
abernix
merged 2 commits into
master
from
abernix/filter-rules-on-reference-equality-rather-than-string-eq
Sep 27, 2019
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ion. The previous technique for deciding which validation rules from `specifiedSDLRules` to by-pass during composition was leveraging a string-comparison against `Function.prototype.name`. As shown in #3335, that technique breaks down under minification, when function names are often munged to shorter alternatives. As an alternative, we can import the rules and check them for reference equality with greater success, since those will not be affected by minification. While the actual bug in #3335 was _not_ in this code, this code poses the same hazard and would likely be affected as well (eventually, at least).
706c3ee
to
cd55231
Compare
jbaxleyiii
approved these changes
Sep 25, 2019
trevor-scheer
approved these changes
Sep 26, 2019
abernix
added a commit
to apollographql/apollo-tooling
that referenced
this pull request
Sep 30, 2019
Similar in spirit to apollographql/apollo-server#3338. The technique previously used for removing rules from the standard `specifiedRules` was leveraging a check on `Function.prototype.name`, rather than doing direct object equality. While that does generally work, thanks to the more recent standardization of `Function.prototype.name`, it still breaks down under some of the more aggressive minification techniques since a function's name is not guaranteed to remain the same. Fixes: apollographql/apollo-server#3335
trevor-scheer
pushed a commit
to apollographql/apollo-tooling
that referenced
this pull request
Oct 2, 2019
…1551) Use object equality when filtering rules in `buildSchemaFromSDL` Similar in spirit to apollographql/apollo-server#3338. The technique previously used for removing rules from the standard `specifiedRules` was leveraging a check on `Function.prototype.name`, rather than doing direct object equality. While that does generally work, thanks to the more recent standardization of `Function.prototype.name`, it still breaks down under some of the more aggressive minification techniques since a function's name is not guaranteed to remain the same. Fixes: apollographql/apollo-server#3335
abernix
added a commit
to apollographql/federation
that referenced
this pull request
Sep 4, 2020
…ion. (apollographql/apollo-server#3338) * Use reference-equality when omitting validation rules during composition. The previous technique for deciding which validation rules from `specifiedSDLRules` to by-pass during composition was leveraging a string-comparison against `Function.prototype.name`. As shown in apollographql/apollo-server#3335, that technique breaks down under minification, when function names are often munged to shorter alternatives. As an alternative, we can import the rules and check them for reference equality with greater success, since those will not be affected by minification. While the actual bug in apollographql/apollo-server#3335 was _not_ in this code, this code poses the same hazard and would likely be affected as well (eventually, at least). * Add changelog entry Apollo-Orig-Commit-AS: apollographql/apollo-server@0bad61d
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The previous technique for deciding which validation rules from
specifiedSDLRules
to by-pass during composition was leveraging a string-comparison againstFunction.prototype.name
.As shown in #3335, that technique breaks down under minification, when function names are often munged to shorter alternatives.
As an alternative, we can import the rules and check them for reference equality with greater success, since those will not be affected by minification.
While the actual bug in #3335 was not in this code, this code poses the same hazard and would likely be affected as well (eventually, at least).