From 2abec167ce4ca620f644f8329aff8d89233867a4 Mon Sep 17 00:00:00 2001 From: NG YUN SHING Date: Sat, 12 Sep 2026 17:37:40 +0000 Subject: [PATCH] permission: clamp Worker grants for explicit execArgv (SEMVER-MAJOR) When the parent has the Permission Model enabled, an explicit Worker execArgv (including []) cannot obtain a wider permission-related grant set than the parent. Default Worker (no execArgv) is unchanged. Keep the main-branch options gate so custom env / NODE_OPTIONS and execArgv: [] still fresh-parse; apply the permission ceiling afterward for any explicit execArgv. Explicit permission tokens without fs grants intersect (stay restrictive) instead of inheriting the parent allowlist. Skip the implicit empty-argv cwd grant after clamp so eval Workers do not re-widen FS reads. When --permission is set, it takes precedence over --permission-audit (enforce mode), matching permissions.md. Signed-off-by: NG YUN SHING --- doc/api/permissions.md | 12 +- doc/api/worker_threads.md | 11 +- src/env.cc | 4 +- src/node_worker.cc | 307 +++++++++++++ .../test-permission-worker-empty-execargv.js | 409 ++++++++++++++++++ 5 files changed, 740 insertions(+), 3 deletions(-) create mode 100644 test/parallel/test-permission-worker-empty-execargv.js diff --git a/doc/api/permissions.md b/doc/api/permissions.md index b677013d7978..b0ce04a0678c 100644 --- a/doc/api/permissions.md +++ b/doc/api/permissions.md @@ -31,6 +31,12 @@ If you find a potential security vulnerability, please refer to our