2023-02-23 18:11:51 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
require('../common');
|
|
|
|
const { spawnSync } = require('child_process');
|
|
|
|
const assert = require('assert');
|
|
|
|
|
|
|
|
const warnFlags = [
|
2023-12-21 17:44:11 +00:00
|
|
|
'--allow-addons',
|
2023-02-23 18:11:51 +00:00
|
|
|
'--allow-child-process',
|
2024-06-01 13:13:12 +00:00
|
|
|
'--allow-wasi',
|
2023-02-23 18:11:51 +00:00
|
|
|
'--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);
|
|
|
|
}
|