-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Closed
Labels
experimentalIssues and PRs related to experimental features.Issues and PRs related to experimental features.fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.permissionIssues and PRs related to the Permission ModelIssues and PRs related to the Permission ModelsecurityIssues and PRs related to security.Issues and PRs related to security.
Description
Version
v22.3.0
Platform
Darwin mac-studio.local 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000 arm64
Subsystem
No response
What steps will reproduce the bug?
- Create new file
test.js
// /Users/skypesky/workSpaces/javascript/github/test.js
const { mkdir } = require('node:fs/promises');
(async () => {
await mkdir('/Users/skypesky/workSpaces/javascript/github/temp/a/b/c/d', { recursive: true });
})();- Execute the following command
➜ node --experimental-permission --allow-fs-write=/Users/skypesky/workSpaces/javascript/github/temp --allow-fs-read=/Users/skypesky/workSpaces/javascript/github/test.js test.js
(node:9132) ExperimentalWarning: Permission is an experimental feature
(Use `node --trace-warnings ...` to show where the warning was created)
node:internal/fs/promises:864
binding.mkdir(pathModule.toNamespacedPath(path),
^
Error: Access to this API has been restricted
at mkdir (node:internal/fs/promises:864:13)
at /Users/skypesky/workSpaces/javascript/github/test.js:4:9
at Object.<anonymous> (/Users/skypesky/workSpaces/javascript/github/test.js:5:3)
at Module._compile (node:internal/modules/cjs/loader:1460:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1544:10)
at Module.load (node:internal/modules/cjs/loader:1275:32)
at Module._load (node:internal/modules/cjs/loader:1091:12)
at wrapModuleLoad (node:internal/modules/cjs/loader:212:19)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:158:5)
at node:internal/main/run_main_module:30:49 {
code: 'ERR_ACCESS_DENIED',
permission: 'FileSystemWrite',
resource: '/Users/skypesky/workSpaces/javascript/github/temp/a/b/c/d'
}
Node.js v22.3.0How often does it reproduce? Is there a required condition?
No response
What is the expected behavior? Why is that the expected behavior?
- I want to create the folder successfully without throwing any errors
- node.js cannot make everyone pre-create folders for these scripts
What do you see instead?
➜ node --experimental-permission --allow-fs-write=/Users/skypesky/workSpaces/javascript/github/temp --allow-fs-read=/Users/skypesky/workSpaces/javascript/github/test.js test.js
(node:9132) ExperimentalWarning: Permission is an experimental feature
(Use `node --trace-warnings ...` to show where the warning was created)
node:internal/fs/promises:864
binding.mkdir(pathModule.toNamespacedPath(path),
^
Error: Access to this API has been restricted
at mkdir (node:internal/fs/promises:864:13)
at /Users/skypesky/workSpaces/javascript/github/test.js:4:9
at Object.<anonymous> (/Users/skypesky/workSpaces/javascript/github/test.js:5:3)
at Module._compile (node:internal/modules/cjs/loader:1460:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1544:10)
at Module.load (node:internal/modules/cjs/loader:1275:32)
at Module._load (node:internal/modules/cjs/loader:1091:12)
at wrapModuleLoad (node:internal/modules/cjs/loader:212:19)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:158:5)
at node:internal/main/run_main_module:30:49 {
code: 'ERR_ACCESS_DENIED',
permission: 'FileSystemWrite',
resource: '/Users/skypesky/workSpaces/javascript/github/temp/a/b/c/d'
}
Node.js v22.3.0Additional information
- I managed to create temp successfully, but I couldn't create a subfolder for temp.
const { mkdir } = require('node:fs/promises');
(async () => {
await mkdir('/Users/skypesky/workSpaces/javascript/github/temp', { recursive: true }); // exec ok!
await mkdir('/Users/skypesky/workSpaces/javascript/github/temp/a/b/c/d', { recursive: true }); // failed
})();Metadata
Metadata
Assignees
Labels
experimentalIssues and PRs related to experimental features.Issues and PRs related to experimental features.fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.permissionIssues and PRs related to the Permission ModelIssues and PRs related to the Permission ModelsecurityIssues and PRs related to security.Issues and PRs related to security.