Skip to content

Commit 44b1927

Browse files
kimtaejin3aduh95
authored andcommitted
lib: use StringPrototypeStartsWith from primordials in locks
Use StringPrototypeStartsWith from primordials instead of String.prototype.startsWith to prevent prototype pollution. Refs: #59699 PR-URL: #61492 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Gürgün Dayıoğlu <[email protected]>
1 parent 3d68811 commit 44b1927

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/internal/locks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class LockManager {
159159
signal.throwIfAborted();
160160
}
161161

162-
if (name.startsWith('-')) {
162+
if (name[0] === '-') {
163163
// If name starts with U+002D HYPHEN-MINUS (-), then reject promise with a
164164
// "NotSupportedError" DOMException.
165165
throw lazyDOMException('Lock name may not start with hyphen',

0 commit comments

Comments
 (0)