diff options
author | Kenta Moriuchi <moriken@kimamass.com> | 2023-03-01 08:14:16 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-01 08:14:16 +0900 |
commit | 55833cf799979e63c6b027fbbf018272308caf5c (patch) | |
tree | cc0ae9aa9116e6296e5e74e1c926cfd94fa26449 /cli/tests/unit/urlpattern_test.ts | |
parent | 6ffbf8a9410f5ea41669efdece60f7f47f77e3c7 (diff) |
fix(core): introduce `SafeRegExp` to primordials (#17592)
Diffstat (limited to 'cli/tests/unit/urlpattern_test.ts')
-rw-r--r-- | cli/tests/unit/urlpattern_test.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cli/tests/unit/urlpattern_test.ts b/cli/tests/unit/urlpattern_test.ts index 1ec64b2fe..9bed09235 100644 --- a/cli/tests/unit/urlpattern_test.ts +++ b/cli/tests/unit/urlpattern_test.ts @@ -43,3 +43,18 @@ Deno.test(function urlPatternFromInit() { assert(pattern.test({ pathname: "/foo/x" })); }); + +Deno.test(function urlPatternWithPrototypePollution() { + const originalExec = RegExp.prototype.exec; + try { + RegExp.prototype.exec = () => { + throw Error(); + }; + const pattern = new URLPattern({ + pathname: "/foo/:bar", + }); + assert(pattern.test("https://deno.land/foo/x")); + } finally { + RegExp.prototype.exec = originalExec; + } +}); |