forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "url: improve port validation"
This reverts commit 5f7730e. This change broke too many edge cases in the ecosystem. Reverting it re-introduces some host-spoofing possibilities, so we won't want to revert forever, but the issue is long-lived enough and not sufficiently critical that we can't wait for a major release to introduce it as a breaking change. After this lands, I plan to re-introduce this as a change that throws a warning rather than an error, after which we can land a semver-major that re-introduces the error and try to get the word out to maintainers of likely-affected packages. Closes: nodejs#45514 Refs: nodejs#45012 PR-URL: nodejs#45517 Fixes: nodejs#45514 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
- Loading branch information
1 parent
9ae2a5f
commit bd960bf
Showing
3 changed files
with
18 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -865,6 +865,22 @@ const parseTests = { | |
href: 'http://a%22%20%3C\'b:b@cd/e?f' | ||
}, | ||
|
||
// Git urls used by npm | ||
'git+ssh://[email protected]:npm/npm': { | ||
protocol: 'git+ssh:', | ||
slashes: true, | ||
auth: 'git', | ||
host: 'github.com', | ||
port: null, | ||
hostname: 'github.com', | ||
hash: null, | ||
search: null, | ||
query: null, | ||
pathname: '/:npm/npm', | ||
path: '/:npm/npm', | ||
href: 'git+ssh://[email protected]/:npm/npm' | ||
}, | ||
|
||
'https://*': { | ||
protocol: 'https:', | ||
slashes: true, | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,15 +74,3 @@ if (common.hasIntl) { | |
(e) => e.code === 'ERR_INVALID_URL', | ||
'parsing http://\u00AD/bad.com/'); | ||
} | ||
|
||
{ | ||
const badURLs = [ | ||
'https://evil.com:.example.com', | ||
'git+ssh://[email protected]:npm/npm', | ||
]; | ||
badURLs.forEach((badURL) => { | ||
assert.throws(() => { url.parse(badURL); }, | ||
(e) => e.code === 'ERR_INVALID_URL', | ||
`parsing ${badURL}`); | ||
}); | ||
} |