From c5b4db04ff2afa44b8197e061c1ab10278dadcdc Mon Sep 17 00:00:00 2001 From: Joe Wollard Date: Thu, 31 Mar 2022 01:34:02 +0000 Subject: [PATCH] test: CWE-1321 --- __tests__/CWE-1321.test.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 __tests__/CWE-1321.test.ts 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", + } + `); + }); +});