Skip to content

Commit a95fb93

Browse files
committed
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 26493c0 commit a95fb93

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

doc/api/url.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,6 +1262,12 @@ A `TypeError` is thrown if `urlString` is not a string.
12621262

12631263
A `URIError` is thrown if the `auth` property is present but cannot be decoded.
12641264

1265+
Use of the legacy `url.parse()` method is discouraged. Users should
1266+
use the WHATWG `URL` API. Because the `url.parse()` method uses a
1267+
lenient, non-standard algorithm for parsing URL strings, security
1268+
issues can be introduced. Specifically, issues with [host name spoofing][] and
1269+
incorrect handling of usernames and passwords have been identified.
1270+
12651271
### `url.resolve(from, to)`
12661272
<!-- YAML
12671273
added: v0.1.25
@@ -1379,6 +1385,7 @@ console.log(myURL.origin);
13791385
[WHATWG URL Standard]: https://url.spec.whatwg.org/
13801386
[WHATWG URL]: #url_the_whatwg_url_api
13811387
[examples of parsed URLs]: https://url.spec.whatwg.org/#example-url-parsing
1388+
[host name spoofing]: https://hackerone.com/reports/678487
13821389
[legacy `urlObject`]: #url_legacy_urlobject
13831390
[percent-encoded]: #whatwg-percent-encoding
13841391
[stable sorting algorithm]: https://en.wikipedia.org/wiki/Sorting_algorithm#Stability

0 commit comments

Comments
 (0)