fix(router): handle outlet named __proto__ when parsing url - #69501
Merged
Conversation
Contributor
|
Thanks! Can you please also update the following in this same PR to use
|
Outlet maps are keyed by names read verbatim from the url, so a name like `__proto__` (e.g. `/one(__proto__:two)`) is assigned through the inherited `__proto__` setter instead of creating an outlet. This drops the outlet and mutates the map's prototype, and throws under Node's `--disable-proto=throw`. Build these outlet maps with `Object.create(null)` so `__proto__` is treated as an ordinary key. Covers `parseParens` and `squashSegmentGroup` in url_tree.ts, `createSegmentGroup` in apply_redirects.ts, and `replaceSegment` and `updateSegmentGroupChildren` in create_url_tree.ts.
arshsmith1
force-pushed
the
router-proto-outlet-name
branch
from
June 25, 2026 07:20
7b5c8a9 to
29641ba
Compare
Contributor
Author
|
Done. Switched all four to |
Contributor
Author
|
gentle ping |
JeanMeche
approved these changes
Jul 6, 2026
Member
|
caretaker note: presubmit is "green", this is good to go ! |
Contributor
|
This pull request has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
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 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.
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