Skip to content

Commit 08ffc63

Browse files
LiviaMedeirosruyadorno
authored andcommitted
tools: restrict internal code from using public url module
PR-URL: #49590 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 6fcb51d commit 08ffc63

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/.eslintrc.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ rules:
175175
message: Use `const { structuredClone } = require('internal/structured_clone');` instead of the global.
176176
- name: SubtleCrypto
177177
message: Use `const { SubtleCrypto } = require('internal/crypto/webcrypto');` instead of the global.
178+
no-restricted-modules:
179+
- error
180+
- name: url
181+
message: Require `internal/url` instead of `url`.
178182
# Custom rules in tools/eslint-rules
179183
node-core/avoid-prototype-pollution: error
180184
node-core/lowercase-name-for-primitive: error

lib/internal/bootstrap/switches/is_main_thread.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ rawMethods.resetStdioForTesting = function() {
290290
// Needed by the module loader and generally needed everywhere.
291291
require('fs');
292292
require('util');
293-
require('url');
293+
require('url'); // eslint-disable-line no-restricted-modules
294294

295295
require('internal/modules/cjs/loader');
296296
require('internal/modules/esm/utils');

0 commit comments

Comments
 (0)