From 97dfaed0909db2085c2cacf7149dd0003d8d9eff Mon Sep 17 00:00:00 2001 From: Rafael Gonzaga Date: Tue, 3 Nov 2026 17:26:19 -0300 Subject: [PATCH] doc: describe how the permission model grants the entrypoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RafaelGSS PR-URL: https://github.com/nodejs/node/pull/67038 Reviewed-By: Luigi Pinca Reviewed-By: Ulises Gascón --- doc/api/cli.md | 6 ++++-- doc/api/permissions.md | 7 +++++++ doc/node.1 | 6 ++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/doc/api/cli.md b/doc/api/cli.md index 07dfa86bc2a..72b1e9ef2e4 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -252,8 +252,10 @@ The valid arguments for the `--allow-fs-read` flag are: Examples can be found in the [File System Permissions][] documentation. -The initializer module and custom `--require` modules has a implicit -read permission. +The initializer module and custom `--require` modules have an implicit +read permission. The entrypoint is granted as passed on the command line, +without the module loader's resolution; see the [File System Permissions][] +documentation for details. ```console $ node --permission -r custom-require.js -r custom-require-2.js index.js diff --git a/doc/api/permissions.md b/doc/api/permissions.md index 21fe47d80c9..65849c4ffc3 100644 --- a/doc/api/permissions.md +++ b/doc/api/permissions.md @@ -226,6 +226,13 @@ $ node -r /path/to/custom-require.js --permission index.js list. * `index.js` will be included in the allowed file system read list. +The entrypoint is granted as passed on the command line, without the module +loader's resolution. If it is a directory, such as in `node --permission .`, +read access is granted to everything inside that directory, recursively. If it +omits the file extension, such as in `node --permission index`, the resolved +`index.js` is not granted. Pass the full path of the file, or use +[`--allow-fs-read`][], to grant exactly what the application needs. + The valid arguments for both flags are: * `*` - To allow all `FileSystemRead` or `FileSystemWrite` operations, diff --git a/doc/node.1 b/doc/node.1 index a67a0709cb3..1ea3590eb7d 100644 --- a/doc/node.1 +++ b/doc/node.1 @@ -150,8 +150,10 @@ Multiple paths can be allowed using multiple \fB--allow-fs-read\fR flags. Example \fB--allow-fs-read=/folder1/ --allow-fs-read=/folder2/\fR .El Examples can be found in the File System Permissions documentation. -The initializer module and custom \fB--require\fR modules has a implicit -read permission. +The initializer module and custom \fB--require\fR modules have an implicit +read permission. The entrypoint is granted as passed on the command line, +without the module loader's resolution; see the File System Permissions +documentation for details. .Bd -literal $ node --permission -r custom-require.js -r custom-require-2.js index.js .Ed