reject prototype-polluting path segments in Path.set - #5756
Open
zayeem06 wants to merge 1 commit into
Open
Conversation
Author
|
any update? |
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.
Reference Issue
N/A
Path.setwalks a dotted path and assigns straight through each segment, so a path whose segments include__proto__,prototype, orconstructor(for example__proto__.pollutedorconstructor.prototype.polluted) writes ontoObject.prototyperather than the target object. This helper backs the elementset()/notifyPathpublic API and the two-way binding change path, so an app that forwards an externally influenced path intosetends up polluting every object. The fix rejects those segments insidesetand returns without writing, which keeps the pollution guard in the shared helper instead of at each call site. Legitimate paths are unaffected, and I added a regression case totest/unit/path.htmlthat asserts the magic keys no-op while ordinary nested and top-level sets still work.