Skip to content

Commit 343c6b8

Browse files
committed
url: replace native methods with primordials
Replace native array methods with primordials in url.js to protect against prototype pollution.
1 parent 05d6b9b commit 343c6b8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/internal/url.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ class URLSearchParams {
551551
name = StringPrototypeToWellFormed(`${name}`);
552552
for (let i = 0; i < list.length; i += 2) {
553553
if (list[i] === name) {
554-
values.push(list[i + 1]);
554+
ArrayPrototypePush(values, list[i + 1]);
555555
}
556556
}
557557
return values;
@@ -1259,11 +1259,11 @@ function parseParams(qs) {
12591259
buf += qs.slice(lastPos, i);
12601260
if (encoded)
12611261
buf = querystring.unescape(buf);
1262-
out.push(buf);
1262+
ArrayPrototypePush(out, buf);
12631263

12641264
// If `buf` is the key, add an empty value.
12651265
if (!seenSep)
1266-
out.push('');
1266+
ArrayPrototypePush(out, '');
12671267

12681268
seenSep = false;
12691269
buf = '';
@@ -1280,7 +1280,7 @@ function parseParams(qs) {
12801280
buf += qs.slice(lastPos, i);
12811281
if (encoded)
12821282
buf = querystring.unescape(buf);
1283-
out.push(buf);
1283+
ArrayPrototypePush(out, buf);
12841284

12851285
seenSep = true;
12861286
buf = '';

0 commit comments

Comments
 (0)