From 77925a426d2f7a237a4bd828ffa3e9b6c5282239 Mon Sep 17 00:00:00 2001 From: Rafael Gonzaga Date: Fri, 23 Oct 2026 14:20:07 -0300 Subject: [PATCH] doc: document --allow-fs-vfs in the permission model page Signed-off-by: RafaelGSS PR-URL: https://github.com/nodejs/node/pull/66793 Reviewed-By: Luigi Pinca --- doc/api/permissions.md | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/doc/api/permissions.md b/doc/api/permissions.md index 44de2ffce67..5d778c6e9e5 100644 --- a/doc/api/permissions.md +++ b/doc/api/permissions.md @@ -92,6 +92,11 @@ This flag grants broad authority to configured OpenSSL STORE loaders, which may access files, devices, tokens, or the network. Access performed by a loader is not constrained by the `fs.read`, `fs.write`, or `net` permission scopes. +Mounting a [virtual file system][] with [`vfs.mount()`][] throws +`ERR_INVALID_STATE` unless the [`--allow-fs-vfs`][] flag is passed. A mounted +VFS serves paths that the file system permissions do not describe, so it is not +gated by [`--allow-fs-read`][] or [`--allow-fs-write`][]. + #### Runtime API When enabling the Permission Model through the [`--permission`][] @@ -156,11 +161,11 @@ mode. Execution continues normally. Audit mode is useful for discovering what permissions your application requires before deploying with [`--permission`][]. It can also be combined -with the [`--allow-fs-read`][], [`--allow-fs-write`][], [`--allow-net`][], -[`--allow-child-process`][], [`--allow-worker`][], [`--allow-addons`][], -[`--allow-wasi`][], [`--allow-ffi`][], [`--allow-inspector`][], -and [`--allow-openssl-store`][] flags to audit a subset -of permissions while granting others. +with the [`--allow-fs-read`][], [`--allow-fs-write`][], [`--allow-fs-vfs`][], +[`--allow-net`][], [`--allow-child-process`][], +[`--allow-worker`][], [`--allow-addons`][], [`--allow-wasi`][], +[`--allow-ffi`][], [`--allow-inspector`][], and [`--allow-openssl-store`][] +flags to audit a subset of permissions while granting others. When a permission check fails in audit mode, a message is published to the diagnostics channel corresponding to the denied scope. The channel names are: @@ -366,6 +371,7 @@ There are constraints you need to know before using this system: * WASI * FFI * OpenSSL STORE loaders + * Virtual file system mounting * The Permission Model is initialized after the Node.js environment is set up. However, certain flags such as `--env-file` or `--openssl-config` are designed to read files before environment initialization. As a result, such flags are @@ -423,6 +429,7 @@ Developers relying on --permission to sandbox untrusted code should be aware tha [`--allow-child-process`]: cli.md#--allow-child-process [`--allow-ffi`]: cli.md#--allow-ffi [`--allow-fs-read`]: cli.md#--allow-fs-read +[`--allow-fs-vfs`]: cli.md#--allow-fs-vfs [`--allow-fs-write`]: cli.md#--allow-fs-write [`--allow-inspector`]: cli.md#--allow-inspector [`--allow-net`]: cli.md#--allow-net @@ -436,3 +443,5 @@ Developers relying on --permission to sandbox untrusted code should be aware tha [`npx`]: https://docs.npmjs.com/cli/commands/npx [`permission.drop()`]: process.md#processpermissiondropscope-reference [`permission.has()`]: process.md#processpermissionhasscope-reference +[`vfs.mount()`]: vfs.md#vfsmount +[virtual file system]: vfs.md