lib: don't check for `/` on windows

This commit is contained in:
Tristan F. 2024-06-29 09:16:19 -04:00
parent da71410bbb
commit 4d24405f45
1 changed files with 4 additions and 2 deletions

View File

@ -44,6 +44,8 @@ const {
},
} = require('internal/v8/startup_snapshot');
const isWindows = process.platform === 'win32';
function prepareMainThreadExecution(expandArgv1 = false, initializeModules = true) {
return prepareExecution({
expandArgv1,
@ -555,14 +557,14 @@ function initializePermission() {
}
}
const fsReadValue = getOptionValue('--allow-fs-read');
if (fsReadValue.length === 1 && (fsReadValue[0] === '*' || fsReadValue[0] === '/')) {
if (fsReadValue.length === 1 && (fsReadValue[0] === '*' || (!isWindows && fsReadValue[0] === '/'))) {
process.emitWarning(
'Granting all to --allow-fs-read leaks all sensitive info on the host machine.',
'SecurityWarning'
);
}
const fsWriteValue = getOptionValue('--allow-fs-write');
if (fsWriteValue.length === 1 && (fsWriteValue[0] === '*' || fsWriteValue[0] === '/')) {
if (fsWriteValue.length === 1 && (fsWriteValue[0] === '*' || (!isWindows && fsWriteValue[0] === '/'))) {
process.emitWarning(
'Granting all to --allow-fs-write will invalidate the permission model. ' +
'Documentation can be found at ' +