mirror of
https://github.com/nodejs/node.git
synced 2025-08-17 06:38:47 +02:00

PR-URL: https://github.com/nodejs/node/pull/51344 Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
26 lines
818 B
JavaScript
26 lines
818 B
JavaScript
// Flags: --expose-internals --experimental-permission --allow-fs-read=test/common* --allow-fs-read=tools* --allow-fs-read=test/parallel* --allow-child-process
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
common.skipIfWorker();
|
|
|
|
if (!common.hasCrypto) {
|
|
common.skip('no crypto');
|
|
}
|
|
|
|
const { internalBinding } = require('internal/test/binding');
|
|
const assert = require('node:assert');
|
|
const fixtures = require('../common/fixtures');
|
|
|
|
const blockedFile = fixtures.path('permission', 'deny', 'protected-file.md');
|
|
const internalFsBinding = internalBinding('fs');
|
|
|
|
// Run this inside a for loop to trigger the fast API
|
|
for (let i = 0; i < 10_000; i++) {
|
|
assert.throws(() => {
|
|
internalFsBinding.internalModuleStat(blockedFile);
|
|
}, {
|
|
code: 'ERR_ACCESS_DENIED',
|
|
permission: 'FileSystemRead',
|
|
});
|
|
}
|