mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
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:
1 parent
5d494effc1
commit
784ca7b1c2
1 file changed
+1
-1
@@ -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',
|
||||
|
||||
Reference in new issue
Block a user