Files
node/test/parallel/test-permission-warning-flags.js
T
Filip Skokan 565c3daebf crypto: support loading private keys through STORE loaders
Accept WHATWG URL objects in private-key inputs and load referenced keys
through OpenSSL STORE loaders. Pass optional property queries and
passphrases while preserving provider-owned EVP_PKEY objects for
ordinary KeyObject and CryptoKey operations.

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/63949
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-08-02 20:18:09 +00:00

46 lines
1.2 KiB
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',
'--allow-openssl-store',
];
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(`\\[PERM\\d{4}\\] SecurityWarning: The flag ${RegExp.escape(flag)} must be used with extreme caution`));
assert.strictEqual(status, 0);
}
const { status, stderr } = spawnSync(
process.execPath,
[
'--permission', '--allow-child-process', '--allow-wasi', '--disable-warning=PERM0002', '-e',
'setTimeout(() => {}, 1)',
]
);
// Disabled warning does not appear
assert.doesNotMatch(stderr.toString(), new RegExp(`The flag --allow-child-process must be used with extreme caution`));
// But non-disabled warnings still appear
assert.match(stderr.toString(), new RegExp(`The flag --allow-wasi must be used with extreme caution`));
assert.strictEqual(status, 0);