From 242aaa0caaf0c15109067b598d58fdeae603c5fd 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 Reviewed-By: Rafael Gonzaga CVE-ID: CVE-2023-32559 PR-URL: https://github.com/nodejs-private/node-private/pull/459 --- 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 b107ebefbf5586..7db32e766ef2d3 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2215,6 +2215,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