From cd1eb3e60b8b16b7dedd3208e0cb29cb3b2a7c45 Mon Sep 17 00:00:00 2001 From: RafaelGSS Date: Tue, 17 Feb 2026 14:40:47 -0300 Subject: [PATCH] src,permission: add --permission-audit Add --permission-audit flag that enables the permission model in warning-only mode. Instead of throwing ERR_ACCESS_DENIED, it emits a message via diagnostics channel and allows the operation to continue. Publish permission check results to per-scope diagnostics channels (e.g., node:permission-model:fs) so users can observe permission decisions at runtime via diagnostics_channel. Refs: https://github.com/nodejs/node/issues/59935 PR-URL: https://github.com/nodejs/node/pull/61869 Backport-PR-URL: https://github.com/nodejs/node/pull/65354 Reviewed-By: Antoine du Hamel --- doc/api/cli.md | 11 +++ doc/node.1 | 5 + lib/internal/process/pre_execution.js | 2 +- src/env.cc | 5 +- src/node_options.cc | 5 + src/node_options.h | 1 + src/permission/permission.cc | 92 ++++++++++++++++++- src/permission/permission.h | 26 ++++-- .../test-permission-diagnostics-channel.js | 29 ++++++ 9 files changed, 164 insertions(+), 12 deletions(-) create mode 100644 test/parallel/test-permission-diagnostics-channel.js diff --git a/doc/api/cli.md b/doc/api/cli.md index ae0f81b5ec5..9880ff83827 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -2137,6 +2137,16 @@ following permissions are restricted: * WASI - manageable through [`--allow-wasi`][] flag * Addons - manageable through [`--allow-addons`][] flag +### `--permission-audit` + + + +Enable audit only for the permission model. When enabled, permission checks +are performed but access is not denied. Instead, a warning is emitted for +each permission violation via diagnostics channel. + ### `--preserve-symlinks`