From 111380e82bdd5e14858e46c4d4749c8a420f502c Mon Sep 17 00:00:00 2001 From: Ryan Qian Date: Fri, 19 Jan 2024 22:51:18 +0800 Subject: [PATCH 1/2] benchmark: fix api restriction for the permission category give appropriate permissions to the following scripts: * permission-processhas-fs-read.js: 'ChildProcess' permission * permission-startup.js: 'FileSystemRead' permission > Paths delimited by comma (,) are no longer allowed. Refs: https://github.com/nodejs/node/blob/main/doc/api/cli.md#--allow-fs-read Signed-off-by: Ryan Qian --- benchmark/permission/permission-processhas-fs-read.js | 1 + benchmark/permission/permission-startup.js | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/benchmark/permission/permission-processhas-fs-read.js b/benchmark/permission/permission-processhas-fs-read.js index bd81814e55861a..e0b2efdb3b2f74 100644 --- a/benchmark/permission/permission-processhas-fs-read.js +++ b/benchmark/permission/permission-processhas-fs-read.js @@ -13,6 +13,7 @@ const options = { flags: [ '--experimental-permission', `--allow-fs-read=${rootPath}`, + '--allow-child-process', ], }; diff --git a/benchmark/permission/permission-startup.js b/benchmark/permission/permission-startup.js index c800706299bb23..a65b5cafdc543f 100644 --- a/benchmark/permission/permission-startup.js +++ b/benchmark/permission/permission-startup.js @@ -47,12 +47,14 @@ function spawnProcess(script, bench, state) { function main({ count, script, nFiles, prefixPath }) { script = path.resolve(__dirname, '../../', `${script}.js`); - const files = mockFiles(nFiles, prefixPath).join(','); const optionsWithScript = [ '--experimental-permission', - `--allow-fs-read=${files},${script}`, - script, + `--allow-fs-read=${script}`, ]; + for (const file of mockFiles(nFiles, prefixPath)) { + optionsWithScript.push('--allow-fs-read=' + file); + } + optionsWithScript.push(script); const warmup = 3; const state = { count, finished: -warmup }; spawnProcess(optionsWithScript, bench, state); From be98c2b0b23c0912b3f0fabc3555fe6a12017589 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 16 May 2024 21:19:29 +0200 Subject: [PATCH 2/2] Update benchmark/permission/permission-startup.js --- benchmark/permission/permission-startup.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/benchmark/permission/permission-startup.js b/benchmark/permission/permission-startup.js index a65b5cafdc543f..08326909aa4e41 100644 --- a/benchmark/permission/permission-startup.js +++ b/benchmark/permission/permission-startup.js @@ -50,11 +50,9 @@ function main({ count, script, nFiles, prefixPath }) { const optionsWithScript = [ '--experimental-permission', `--allow-fs-read=${script}`, + ...mockFiles(nFiles, prefixPath).map((file) => '--allow-fs-read=' + file), + script, ]; - for (const file of mockFiles(nFiles, prefixPath)) { - optionsWithScript.push('--allow-fs-read=' + file); - } - optionsWithScript.push(script); const warmup = 3; const state = { count, finished: -warmup }; spawnProcess(optionsWithScript, bench, state);