summaryrefslogtreecommitdiff
path: root/cli/tests/unit/headers_test.ts
diff options
context:
space:
mode:
authorKenta Moriuchi <moriken@kimamass.com>2023-03-01 08:14:16 +0900
committerGitHub <noreply@github.com>2023-03-01 08:14:16 +0900
commit55833cf799979e63c6b027fbbf018272308caf5c (patch)
treecc0ae9aa9116e6296e5e74e1c926cfd94fa26449 /cli/tests/unit/headers_test.ts
parent6ffbf8a9410f5ea41669efdece60f7f47f77e3c7 (diff)
fix(core): introduce `SafeRegExp` to primordials (#17592)
Diffstat (limited to 'cli/tests/unit/headers_test.ts')
-rw-r--r--cli/tests/unit/headers_test.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/cli/tests/unit/headers_test.ts b/cli/tests/unit/headers_test.ts
index fda4e81d9..295f03071 100644
--- a/cli/tests/unit/headers_test.ts
+++ b/cli/tests/unit/headers_test.ts
@@ -325,6 +325,21 @@ Deno.test(function headersInitMultiple() {
]);
});
+Deno.test(function headerInitWithPrototypePollution() {
+ const originalExec = RegExp.prototype.exec;
+ try {
+ RegExp.prototype.exec = () => {
+ throw Error();
+ };
+ new Headers([
+ ["X-Deno", "foo"],
+ ["X-Deno", "bar"],
+ ]);
+ } finally {
+ RegExp.prototype.exec = originalExec;
+ }
+});
+
Deno.test(function headersAppendMultiple() {
const headers = new Headers([
["Set-Cookie", "foo=bar"],