mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
PR-URL: https://github.com/nodejs/node/pull/62072 Co-authored-by: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Bryan English <bryan@bryanenglish.com>
31 lines
680 B
JavaScript
31 lines
680 B
JavaScript
'use strict';
|
|
|
|
require('../common');
|
|
const { spawnSync } = require('child_process');
|
|
const assert = require('assert');
|
|
|
|
const warnFlags = [
|
|
'--allow-addons',
|
|
'--allow-child-process',
|
|
'--allow-inspector',
|
|
'--allow-wasi',
|
|
'--allow-worker',
|
|
];
|
|
|
|
if (process.config.variables.node_use_ffi) {
|
|
warnFlags.push('--allow-ffi');
|
|
}
|
|
|
|
for (const flag of warnFlags) {
|
|
const { status, stderr } = spawnSync(
|
|
process.execPath,
|
|
[
|
|
'--permission', flag, '-e',
|
|
'setTimeout(() => {}, 1)',
|
|
]
|
|
);
|
|
|
|
assert.match(stderr.toString(), new RegExp(`SecurityWarning: The flag ${RegExp.escape(flag)} must be used with extreme caution`));
|
|
assert.strictEqual(status, 0);
|
|
}
|