From 784ca7b1c24076c10ff35ac2baa6f8a6cfbdeba1 Mon Sep 17 00:00:00 2001 From: Taejin Kim <60560836+kimtaejin3@users.noreply.github.com> Date: Fri, 30 Jan 2026 07:27:49 +0900 Subject: [PATCH] lib: use StringPrototypeStartsWith from primordials in locks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use StringPrototypeStartsWith from primordials instead of String.prototype.startsWith to prevent prototype pollution. Refs: https://github.com/nodejs/node/issues/59699 PR-URL: https://github.com/nodejs/node/pull/61492 Reviewed-By: Antoine du Hamel Reviewed-By: Colin Ihrig Reviewed-By: Gürgün Dayıoğlu --- lib/internal/locks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/locks.js b/lib/internal/locks.js index b3d605aa8bc..054197bcaef 100644 --- a/lib/internal/locks.js +++ b/lib/internal/locks.js @@ -159,7 +159,7 @@ class LockManager { signal.throwIfAborted(); } - if (name.startsWith('-')) { + if (name[0] === '-') { // If name starts with U+002D HYPHEN-MINUS (-), then reject promise with a // "NotSupportedError" DOMException. throw lazyDOMException('Lock name may not start with hyphen',