Repository navigation
Conversation
Collaborator
|
Review requested:
|
mcollina
force-pushed
the
fix-urltohttpoptions-options-injection
branch
from
November 13, 2026 12:56
38881e3 to
75bfa0e
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #67454 +/- ##
==========================================
- Coverage 92.62% 90.70% -1.92%
==========================================
Files 430 802 +372
Lines 196333 282114 +85781
Branches 29897 54349 +24452
==========================================
+ Hits 181849 255886 +74037
- Misses 14159 16369 +2210
- Partials 325 9859 +9534
🚀 New features to boost your workflow:
|
mcollina
force-pushed
the
fix-urltohttpoptions-options-injection
branch
from
November 13, 2026 14:58
75bfa0e to
19b7a66
Compare
Only spread own enumerable properties for URL instances created by this realm's URL constructor. Duck-typed objects accepted by isURL() can no longer smuggle connection options (socketPath, method, headers, agent) into a request. This fixes a footgun where a hostname-validated http.request() could be redirected to a Unix socket (e.g. the Docker daemon) via a URL-shaped object, bypassing hostname-based SSRF checks. Extending a genuine URL object with extra options is preserved. PR-URL: nodejs#67454 Refs: nodejs#46989 Signed-off-by: Matteo Collina <hello@matteocollina.com>
mcollina
force-pushed
the
fix-urltohttpoptions-options-injection
branch
from
November 13, 2026 15:27
19b7a66 to
edbd599
Compare
jasnell
approved these changes
Nov 14, 2026
This comment was marked as outdated.
This comment was marked as outdated.
Collaborator
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.
urlToHttpOptions()currently spreads all own enumerable properties of its argument into the request options. Whenhttp.request()/https.request()is passed a URL-shaped object that satisfies the duck-typedisURL()check but is not a genuine WHATWGURLinstance, arbitrary transport/connection options such assocketPath,method,headers, oragentare copied into the request options. This lets an attacker-supplied object redirect a hostname-validated request to a Unix domain socket (for example the Docker daemon), defeating hostname-based SSRF defenses.The spread is only meaningful for a genuine WHATWG
URLinstance that a user has extended with additional own enumerable properties (for exampleurl.headers = ...), as introduced in #46989. A realURLinstance has no own enumerable properties of its own, so gating the spread on the existingisURLInstance()brand check preserves that feature while preventing the duck-typed smuggling vector.Adds a unit test in
test-url-urltooptions.jsand an end-to-end regression test verifying that a hostname-validated request is no longer redirected to an injectedsocketPath.