0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 21:19:50 +01:00
nodejs/test/parallel/test-permission-allow-wasi-cli.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

23 lines
480 B
JavaScript

// Flags: --experimental-permission --allow-wasi --allow-fs-read=*
'use strict';
const common = require('../common');
common.skipIfWorker();
const assert = require('assert');
const { WASI } = require('wasi');
// Guarantee the initial state
{
assert.ok(process.permission.has('wasi'));
}
// When a permission is set by cli, the process shouldn't be able
// to create WASI instance unless --allow-wasi is sent
{
// doesNotThrow
new WASI({
version: 'preview1',
});
}