Node.js › Advanced Node.js
What are Node.js's experimental permission model flags, and what problem do they address?
AdvancedAnswer
Introduced behind the --experimental-permission flag, Node's permission model lets you restrict what a running process is allowed to do -- for example, denying file system access outside specific directories, or blocking the ability to spawn child processes -- at the process level rather than relying purely on OS-level sandboxing or third-party libraries. This addresses supply-chain risk: if a compromised or malicious npm dependency tries to read arbitrary files or make unexpected network calls, a properly configured permission model can block it outright.
# Only allow file system read access to a specific directory
node --experimental-permission --allow-fs-read=/app/data server.js
# Deny child process spawning entirely
node --experimental-permission --allow-child-process=false server.jsReal-world example A company running third-party plugin code inside their Node.js platform enables the permission model to restrict plugins to read-only access within a designated sandbox directory, containing the blast radius if a malicious or buggy plugin is ever installed.