deno.land / x / msgpack_javascript@v3.0.0-beta2 / test / prototype-pollution.test.ts

prototype-pollution.test.ts
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { throws } from "assert";import { encode, decode, DecodeError } from "@msgpack/msgpack";
describe("prototype pollution", () => { context("__proto__ exists as a map key", () => { it("raises DecodeError in decoding", () => { const o = { foo: "bar", }; // override __proto__ as an enumerable property Object.defineProperty(o, "__proto__", { value: new Date(0), enumerable: true, }); const encoded = encode(o);
throws(() => { decode(encoded); }, DecodeError); }); });});
msgpack_javascript

Version Info

Tagged at
a year ago