Skip to content

Commit 648e3ed

Browse files
RafaelGSSaduh95
authored andcommitted
doc: document --allow-fs-vfs in the permission model page
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com> PR-URL: #66793 Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 448169c commit 648e3ed

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

‎doc/api/permissions.md‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ This flag grants broad authority to configured OpenSSL STORE loaders, which may
9292
access files, devices, tokens, or the network. Access performed by a loader is
9393
not constrained by the `fs.read`, `fs.write`, or `net` permission scopes.
9494

95+
Mounting a [virtual file system][] with [`vfs.mount()`][] throws
96+
`ERR_INVALID_STATE` unless the [`--allow-fs-vfs`][] flag is passed. A mounted
97+
VFS serves paths that the file system permissions do not describe, so it is not
98+
gated by [`--allow-fs-read`][] or [`--allow-fs-write`][].
99+
95100
#### Runtime API
96101

97102
When enabling the Permission Model through the [`--permission`][]
@@ -156,11 +161,11 @@ mode. Execution continues normally.
156161

157162
Audit mode is useful for discovering what permissions your application
158163
requires before deploying with [`--permission`][]. It can also be combined
159-
with the [`--allow-fs-read`][], [`--allow-fs-write`][], [`--allow-net`][],
160-
[`--allow-child-process`][], [`--allow-worker`][], [`--allow-addons`][],
161-
[`--allow-wasi`][], [`--allow-ffi`][], [`--allow-inspector`][],
162-
and [`--allow-openssl-store`][] flags to audit a subset
163-
of permissions while granting others.
164+
with the [`--allow-fs-read`][], [`--allow-fs-write`][], [`--allow-fs-vfs`][],
165+
[`--allow-net`][], [`--allow-child-process`][],
166+
[`--allow-worker`][], [`--allow-addons`][], [`--allow-wasi`][],
167+
[`--allow-ffi`][], [`--allow-inspector`][], and [`--allow-openssl-store`][]
168+
flags to audit a subset of permissions while granting others.
164169

165170
When a permission check fails in audit mode, a message is published to the
166171
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:
366371
* WASI
367372
* FFI
368373
* OpenSSL STORE loaders
374+
* Virtual file system mounting
369375
* The Permission Model is initialized after the Node.js environment is set up.
370376
However, certain flags such as `--env-file` or `--openssl-config` are designed
371377
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
423429
[`--allow-child-process`]: cli.md#--allow-child-process
424430
[`--allow-ffi`]: cli.md#--allow-ffi
425431
[`--allow-fs-read`]: cli.md#--allow-fs-read
432+
[`--allow-fs-vfs`]: cli.md#--allow-fs-vfs
426433
[`--allow-fs-write`]: cli.md#--allow-fs-write
427434
[`--allow-inspector`]: cli.md#--allow-inspector
428435
[`--allow-net`]: cli.md#--allow-net
@@ -436,3 +443,5 @@ Developers relying on --permission to sandbox untrusted code should be aware tha
436443
[`npx`]: https://docs.npmjs.com/cli/commands/npx
437444
[`permission.drop()`]: process.md#processpermissiondropscope-reference
438445
[`permission.has()`]: process.md#processpermissionhasscope-reference
446+
[`vfs.mount()`]: vfs.md#vfsmount
447+
[virtual file system]: vfs.md

0 commit comments

Comments
 (0)