From d4570fae358693b8f7fec05294b9bb92a966226d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Sun, 16 Apr 2023 22:26:47 +0200 Subject: [PATCH] policy: disable process.binding() when enabled process.binding() can be used to trivially bypass restrictions imposed through a policy. Since the function is deprecated already, simply replace it with a stub when a policy is being enabled. Fixes: https://hackerone.com/bugs?report_id=1946470 PR-URL: https://github.com/nodejs-private/node-private/pull/460 CVE-ID: CVE-2023-32559 --- doc/api/deprecations.md | 4 +++ doc/api/errors.md | 8 ++++++ lib/internal/errors.js | 3 ++ lib/internal/process/policy.js | 10 +++++++ test/fixtures/policy/process-binding/app.js | 10 +++++++ .../policy/process-binding/policy.json | 10 +++++++ test/parallel/test-policy-process-binding.js | 28 +++++++++++++++++++ 7 files changed, 73 insertions(+) create mode 100644 test/fixtures/policy/process-binding/app.js create mode 100644 test/fixtures/policy/process-binding/policy.json create mode 100644 test/parallel/test-policy-process-binding.js diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 4a52b467b5df6b..9882b802bf3e3b 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2208,6 +2208,9 @@ Type: Documentation-only (supports [`--pending-deprecation`][]) `process.binding()` is for use by Node.js internal code only. +While `process.binding()` has not reached End-of-Life status in general, it is +unavailable when [policies][] are enabled. + ### DEP0112: `dgram` private APIs