-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a documentation-deprecation only and it is possible that it will not proceed to a runtime-deprecation any time in the foreseeable future. But url.parse() is not standardized and prone to errors that have security implications. Refs: #44911 (comment) PR-URL: #44919 Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Rafael Gonzaga <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Danielle Adams <[email protected]>
- Loading branch information
1 parent
4fcbc92
commit b4cc30e
Showing
2 changed files
with
31 additions
and
16 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 |
---|---|---|
|
@@ -27,7 +27,7 @@ The `node:url` module provides two APIs for working with URLs: a legacy API that | |
is Node.js specific, and a newer API that implements the same | ||
[WHATWG URL Standard][] used by web browsers. | ||
|
||
A comparison between the WHATWG and Legacy APIs is provided below. Above the URL | ||
A comparison between the WHATWG and legacy APIs is provided below. Above the URL | ||
`'https://user:[email protected]:8080/p/a/t/h?query=string#hash'`, properties | ||
of an object returned by the legacy `url.parse()` are shown. Below it are | ||
properties of a WHATWG `URL` object. | ||
|
@@ -63,7 +63,7 @@ const myURL = | |
new URL('https://user:[email protected]:8080/p/a/t/h?query=string#hash'); | ||
``` | ||
|
||
Parsing the URL string using the Legacy API: | ||
Parsing the URL string using the legacy API: | ||
|
||
```mjs | ||
import url from 'node:url'; | ||
|
@@ -1521,6 +1521,9 @@ The formatting process operates as follows: | |
<!-- YAML | ||
added: v0.1.25 | ||
changes: | ||
- version: REPLACEME | ||
pr-url: https://github.com/nodejs/node/pull/44919 | ||
description: Documentation-only deprecation. | ||
- version: | ||
- v15.13.0 | ||
- v14.17.0 | ||
|
@@ -1540,7 +1543,7 @@ changes: | |
when no query string is present. | ||
--> | ||
> Stability: 3 - Legacy: Use the WHATWG URL API instead. | ||
> Stability: 0 - Deprecated: Use the WHATWG URL API instead. | ||
* `urlString` {string} The URL string to parse. | ||
* `parseQueryString` {boolean} If `true`, the `query` property will always | ||
|
@@ -1562,16 +1565,9 @@ A `URIError` is thrown if the `auth` property is present but cannot be decoded. | |
|
||
`url.parse()` uses a lenient, non-standard algorithm for parsing URL | ||
strings. It is prone to security issues such as [host name spoofing][] | ||
and incorrect handling of usernames and passwords. | ||
|
||
`url.parse()` is an exception to most of the legacy APIs. Despite its security | ||
concerns, it is legacy and not deprecated because it is: | ||
|
||
* Faster than the alternative WHATWG `URL` parser. | ||
* Easier to use with regards to relative URLs than the alternative WHATWG `URL` API. | ||
* Widely relied upon within the npm ecosystem. | ||
|
||
Use with caution. | ||
and incorrect handling of usernames and passwords. Do not use with untrusted | ||
input. CVEs are not issued for `url.parse()` vulnerabilities. Use the | ||
[WHATWG URL][] API instead. | ||
|
||
### `url.resolve(from, to)` | ||
|
||
|