lib: use StringPrototypeStartsWith from primordials in locks

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 <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
This commit is contained in:
Taejin Kim authored and GitHub committed 2026-01-29 22:27:49 +00:00
1 parent 5d494effc1
commit 784ca7b1c2
1 file changed
+1 -1
+1 -1
View File
@@ -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',