0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 21:19:50 +01:00
nodejs/test/parallel/test-permission-warning-flags.js
Rafael Gonzaga 3ab0499d43
src,permission: --allow-wasi & prevent WASI exec
PR-URL: https://github.com/nodejs/node/pull/53124
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2024-06-01 13:13:12 +00:00

26 lines
574 B
JavaScript

'use strict';
require('../common');
const { spawnSync } = require('child_process');
const assert = require('assert');
const warnFlags = [
'--allow-addons',
'--allow-child-process',
'--allow-wasi',
'--allow-worker',
];
for (const flag of warnFlags) {
const { status, stderr } = spawnSync(
process.execPath,
[
'--experimental-permission', flag, '-e',
'setTimeout(() => {}, 1)',
]
);
assert.match(stderr.toString(), new RegExp(`SecurityWarning: The flag ${flag} must be used with extreme caution`));
assert.strictEqual(status, 0);
}