node/test/fixtures/permission/fs-read-loader.js
Rafael Gonzaga f58613a64c
src,permission: implicit allow-fs-read to app entrypoint
This commit automatically includes in the allow-fs-read
list all the app's entrypoints.

`--require` and user entry point

Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com>
PR-URL: https://github.com/nodejs/node/pull/58579
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
2025-06-07 13:33:25 +00:00

15 lines
No EOL
448 B
JavaScript

const fs = require('node:fs')
const path = require('node:path')
const assert = require('node:assert');
{
fs.readFileSync(__filename);
console.log('Read its own contents') // Should not throw
}
{
const simpleLoaderPath = path.join(__dirname, 'simple-loader.js');
fs.readFile(simpleLoaderPath, (err) => {
assert.ok(err.code, 'ERR_ACCESS_DENIED');
assert.ok(err.permission, 'FileSystemRead');
}); // Should throw ERR_ACCESS_DENIED
}