File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -3271,13 +3271,16 @@ Node-API callbacks.
32713271
32723272<!-- YAML
32733273changes:
3274+ - version: REPLACEME
3275+ pr-url: https://github.com/nodejs/node/pull/47203
3276+ description: Added support for `--pending-deprecation`.
32743277 - version:
32753278 - v18.13.0
32763279 pr-url: https://github.com/nodejs/node/pull/44919
32773280 description: Documentation-only deprecation.
32783281-->
32793282
3280- Type: Documentation-only
3283+ Type: Documentation-only (supports [ ` --pending-deprecation ` ] [ ] )
32813284
32823285[ ` url.parse() ` ] [ ] behavior is not standardized and prone to errors that
32833286have 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 {
6363 formatUrl,
6464} = internalBinding ( 'url' ) ;
6565
66+ const { getOptionValue } = require ( 'internal/options' ) ;
67+
6668// Original url.parse() API
6769
6870function Url ( ) {
@@ -147,7 +149,20 @@ const {
147149 CHAR_COLON ,
148150} = require ( 'internal/constants' ) ;
149151
152+ let urlParseWarned = false ;
153+
150154function 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+
151166 if ( url instanceof Url ) return url ;
152167
153168 const urlObject = new Url ( ) ;
You can’t perform that action at this time.
0 commit comments