diff --git a/__tests__/CWE-1321.test.ts b/__tests__/CWE-1321.test.ts new file mode 100644 index 0000000..8d9a6e3 --- /dev/null +++ b/__tests__/CWE-1321.test.ts @@ -0,0 +1,16 @@ +import plist from "../src"; + +/** @see https://cwe.mitre.org/data/definitions/1321.html */ + +describe("CWE-1321", () => { + it("filters out unsafe properties", () => { + const unsafeDoc = { __proto__: 42, foo: "bar" }; + const safeDoc = plist.parse(plist.stringify(unsafeDoc)); + + expect(safeDoc).toMatchInlineSnapshot(` + Object { + "foo": "bar", + } + `); + }); +});