Skip to content

Commit 0ebb30b

Browse files
jasnelladdaleax
authored andcommitted
doc: document security issues with url.parse()
Fixes: #31279 PR-URL: #34226 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent 4e07faa commit 0ebb30b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

doc/api/url.md

+7
Original file line numberDiff line numberDiff line change
@@ -1244,6 +1244,12 @@ A `TypeError` is thrown if `urlString` is not a string.
12441244

12451245
A `URIError` is thrown if the `auth` property is present but cannot be decoded.
12461246

1247+
Use of the legacy `url.parse()` method is discouraged. Users should
1248+
use the WHATWG `URL` API. Because the `url.parse()` method uses a
1249+
lenient, non-standard algorithm for parsing URL strings, security
1250+
issues can be introduced. Specifically, issues with [host name spoofing][] and
1251+
incorrect handling of usernames and passwords have been identified.
1252+
12471253
### `url.resolve(from, to)`
12481254
<!-- YAML
12491255
added: v0.1.25
@@ -1361,6 +1367,7 @@ console.log(myURL.origin);
13611367
[WHATWG URL Standard]: https://url.spec.whatwg.org/
13621368
[WHATWG URL]: #url_the_whatwg_url_api
13631369
[examples of parsed URLs]: https://url.spec.whatwg.org/#example-url-parsing
1370+
[host name spoofing]: https://hackerone.com/reports/678487
13641371
[legacy `urlObject`]: #url_legacy_urlobject
13651372
[percent-encoded]: #whatwg-percent-encoding
13661373
[stable sorting algorithm]: https://en.wikipedia.org/wiki/Sorting_algorithm#Stability

0 commit comments

Comments
 (0)