From 061d4860f7478f276d470ff1f54bc7da46deacf0 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Mon, 6 Jul 2020 12:59:12 -0700 Subject: [PATCH 1/3] doc: document security issues with url.parse() Fixes: https://github.com/nodejs/node/issues/31279 --- doc/api/url.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/api/url.md b/doc/api/url.md index 7d493026fd46ea..c02b737a2b2c01 100644 --- a/doc/api/url.md +++ b/doc/api/url.md @@ -1262,6 +1262,12 @@ A `TypeError` is thrown if `urlString` is not a string. A `URIError` is thrown if the `auth` property is present but cannot be decoded. +Use of the legacy `url.parse()` method is not recommended. All users should +migrate to the WHATWG `URL` api. Because the `url.parse()` method uses a +lenient, non-standards compliant algorithm for parsing URL strings, security +issues can be introduced. Specifically, issues with [hostname spoofing][] and +incorrect handling of user info (usernames and passwords) have been identified. + ### `url.resolve(from, to)`