fix(router): handle outlet named __proto__ when parsing url#69501
Open
arshsmith1 wants to merge 1 commit into
Open
fix(router): handle outlet named __proto__ when parsing url#69501arshsmith1 wants to merge 1 commit into
arshsmith1 wants to merge 1 commit into
Conversation
A url group outlet name is read verbatim, so a url like `/one(__proto__:two)` assigns a segment group to `segments['__proto__']` and goes through the inherited `__proto__` setter instead of creating the outlet. Build the outlet map with `Object.create(null)` so the name is treated as an ordinary key.
Contributor
|
Thanks! Can you please also update the following in this same PR to use
|
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.
PR Checklist
PR Type
What is the current behavior?
Issue Number: N/A
A named outlet in a url group like
/(name:child)is read verbatim from the url, so a url such as/one(__proto__:two)makesUrlParser.parseParensassign aUrlSegmentGrouptosegments['__proto__']. On a plain object that assignment goes through the inherited__proto__setter instead of creating an outlet, so the outlet is silently dropped and the map's prototype is replaced.url.parse('/one(__proto__:two)')therefore round-trips back to/oneand reports a single child, and under Node started with--disable-proto=throwthe same parse throwsERR_PROTO_ACCESS.What is the new behavior?
The outlet map is built with
Object.create(null), so__proto__is treated as an ordinary key. The outlet is kept, the prototype is left untouched, and/one(__proto__:two)serializes back unchanged.Does this PR introduce a breaking change?
Other information