Prevent accessing response object's prototype chain#3396
Merged
Conversation
✅ Docs preview has no changesThe preview was not built because there were no changes. Build ID: b924d4b045256576c6d96c54 ✅ AI Style Review — No Changes DetectedNo MDX files were changed in this pull request. Review Log: View detailed log
|
🦋 Changeset detectedLatest commit: 5f9a9b3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
sachindshinde
approved these changes
Mar 13, 2026
Currently, when iterating through the `source`'s own properties in `deepMerge()`, we do not check whether the property is also an own property of `target`. This can lead to a bug where the prototype chain of `target` is mistakenly searched for the property, and if found, the data in `source` may then be merged into that non-own property's value, potentially causing issues for other objects that share that prototype chain. In one example, properties being defined in `source` were used to add properties to `Object.prototype`, which is a security issue. The fix here is to explicitly initialize the property on `target` if it's a non-own property of `target` via `Object.defineProperty()`. With this change, any downstream references to `target[key]` are guaranteed to change the `key` property on `target` instead of some property upstream in the prototype chain. (We can also remove the bit that skips the `__proto__` property, as this results in a bug when a GraphQL field is aliased to this.) --------- Co-authored-by: Duckki Oe <duckki.oe@apollographql.com>
… with existing ones
…not use a null-prototype object.
…n executeFetch().
… providedVariables.
…ties via the "in" operator.
…es for field selections.
…ies when recursing.
6aa30b9 to
f313ad5
Compare
f984d85 to
5f9a9b3
Compare
sachindshinde
added a commit
that referenced
this pull request
Mar 13, 2026
…for 2.11) (#3398) Fixed several code paths that access response objects to prevent JavaScript prototype pollution and unintended access to the prototype chain. --------- Co-authored-by: Sachin D. Shinde <sachin@apollographql.com>
sachindshinde
added a commit
that referenced
this pull request
Mar 13, 2026
…for 2.10) (#3399) Fixed several code paths that access response objects to prevent JavaScript prototype pollution and unintended access to the prototype chain. --------- Co-authored-by: Sachin D. Shinde <sachin@apollographql.com>
sachindshinde
added a commit
that referenced
this pull request
Mar 13, 2026
…for 2.12) (#3397) Fixed several code paths that access response objects to prevent JavaScript prototype pollution and unintended access to the prototype chain. --------- Co-authored-by: Sachin D. Shinde <sachin@apollographql.com>
sachindshinde
added a commit
that referenced
this pull request
Mar 13, 2026
…for 2.9) (#3400) Fixed several code paths that access response objects to prevent JavaScript prototype pollution and unintended access to the prototype chain. --------- Co-authored-by: Sachin D. Shinde <sachin@apollographql.com>
sachindshinde
pushed a commit
that referenced
this pull request
Mar 13, 2026
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @apollo/composition@2.13.2 ### Patch Changes - Updated dependencies \[[`84e9226b606b176ede097410f5ba35ba03d140ed`](84e9226)]: - @apollo/federation-internals@2.13.2 - @apollo/query-graphs@2.13.2 ## @apollo/gateway@2.13.2 ### Patch Changes - Fixed several code paths that access response objects to prevent JavaScript prototype pollution and unintended access to the prototype chain. ([#3396](#3396)) See the associated GitHub Advisories [GHSA-pfjj-6f4p-rvmh](GHSA-pfjj-6f4p-rvmh) for more information. - Updated dependencies \[[`84e9226b606b176ede097410f5ba35ba03d140ed`](84e9226)]: - @apollo/query-planner@2.13.2 - @apollo/federation-internals@2.13.2 - @apollo/composition@2.13.2 ## @apollo/federation-internals@2.13.2 ### Patch Changes - Fixed several code paths that access response objects to prevent JavaScript prototype pollution and unintended access to the prototype chain. ([#3396](#3396)) See the associated GitHub Advisories [GHSA-pfjj-6f4p-rvmh](GHSA-pfjj-6f4p-rvmh) for more information. ## @apollo/query-graphs@2.13.2 ### Patch Changes - Updated dependencies \[[`84e9226b606b176ede097410f5ba35ba03d140ed`](84e9226)]: - @apollo/federation-internals@2.13.2 ## @apollo/query-planner@2.13.2 ### Patch Changes - Fixed several code paths that access response objects to prevent JavaScript prototype pollution and unintended access to the prototype chain. ([#3396](#3396)) See the associated GitHub Advisories [GHSA-pfjj-6f4p-rvmh](GHSA-pfjj-6f4p-rvmh) for more information. - Updated dependencies \[[`84e9226b606b176ede097410f5ba35ba03d140ed`](84e9226)]: - @apollo/federation-internals@2.13.2 - @apollo/query-graphs@2.13.2 ## @apollo/subgraph@2.13.2 ### Patch Changes - Updated dependencies \[[`84e9226b606b176ede097410f5ba35ba03d140ed`](84e9226)]: - @apollo/federation-internals@2.13.2 ## apollo-federation-integration-testsuite@2.13.2 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixed several code paths that access response objects to prevent JavaScript prototype pollution and unintended access to the prototype chain.