| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9cbf897 commit 7fb1980
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3271,13 +3271,16 @@ Node-API callbacks. | |||
| 3271 | 3271 | ||
| 3272 | 3272 | <!-- YAML | |
| 3273 | 3273 | changes: | |
| 3274 | + - version: REPLACEME | ||
| 3275 | + pr-url: https://github.com/nodejs/node/pull/47203 | ||
| 3276 | + description: Added support for `--pending-deprecation`. | ||
| 3274 | 3277 | - version: | |
| 3275 | 3278 | - v18.13.0 | |
| 3276 | 3279 | pr-url: https://github.com/nodejs/node/pull/44919 | |
| 3277 | 3280 | description: Documentation-only deprecation. | |
| 3278 | 3281 | --> | |
| 3279 | 3282 | ||
| 3280 | - Type: Documentation-only | ||
| 3283 | + Type: Documentation-only (supports [`--pending-deprecation`][]) | ||
| 3281 | 3284 | ||
| 3282 | 3285 | [`url.parse()`][] behavior is not standardized and prone to errors that | |
| 3283 | 3286 | have security implications. Use the [WHATWG URL API][] instead. CVEs are not | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -63,6 +63,8 @@ const { | |||
| 63 | 63 | formatUrl, | |
| 64 | 64 | } = internalBinding('url'); | |
| 65 | 65 | ||
| 66 | + const { getOptionValue } = require('internal/options'); | ||
| 67 | + | ||
| 66 | 68 | // Original url.parse() API | |
| 67 | 69 | ||
| 68 | 70 | function Url() { | |
@@ -147,7 +149,20 @@ const { | |||
| 147 | 149 | CHAR_COLON, | |
| 148 | 150 | } = require('internal/constants'); | |
| 149 | 151 | ||
| 152 | + let urlParseWarned = false; | ||
| 153 | + | ||
| 150 | 154 | function urlParse(url, parseQueryString, slashesDenoteHost) { | |
| 155 | + if (!urlParseWarned && getOptionValue('--pending-deprecation')) { | ||
| 156 | + urlParseWarned = true; | ||
| 157 | + process.emitWarning( | ||
| 158 | + '`url.parse()` behavior is not standardized and prone to ' + | ||
| 159 | + 'errors that have security implications. Use the WHATWG URL API ' + | ||
| 160 | + 'instead. CVEs are not issued for `url.parse()` vulnerabilities.', | ||
| 161 | + 'DeprecationWarning', | ||
| 162 | + 'DEP0169', | ||
| 163 | + ); | ||
| 164 | + } | ||
| 165 | + | ||
| 151 | 166 | if (url instanceof Url) return url; | |
| 152 | 167 | ||
| 153 | 168 | const urlObject = new Url(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments