Skip to content

Commit

Permalink
benchmark: fix api restriction for the permission category
Browse files Browse the repository at this point in the history
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 <i@bitbili.net>
  • Loading branch information
bekcpear committed Jan 19, 2024
1 parent e0b159e commit 6331544
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions benchmark/permission/permission-processhas-fs-read.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const options = {
flags: [
'--experimental-permission',
`--allow-fs-read=${rootPath}`,
'--allow-child-process',
],
};

Expand Down
8 changes: 5 additions & 3 deletions benchmark/permission/permission-startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check failure on line 55 in benchmark/permission/permission-startup.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Strings must use singlequote

Check failure on line 55 in benchmark/permission/permission-startup.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Missing semicolon
}
optionsWithScript.push(script)

Check failure on line 57 in benchmark/permission/permission-startup.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Missing semicolon
const warmup = 3;
const state = { count, finished: -warmup };
spawnProcess(optionsWithScript, bench, state);
Expand Down

0 comments on commit 6331544

Please sign in to comment.