Skip to content

Commit 845879b

Browse files
fortiZdeTimo Machellukeed
authored
chore(merge): add tests for "__proto__" key (#38)
* fixed issue#33 CVE-2022-25645 added test for it * Apply suggestions from code review Co-authored-by: Timo Machel <[email protected]> Co-authored-by: Luke Edwards <[email protected]>
1 parent 2d156c7 commit 845879b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/suites/pollution.js

+10
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,15 @@ export default function (dset) {
8585
});
8686
});
8787

88+
// Test for CVE-2022-25645 - CWE-1321
89+
pollution('should ignore JSON.parse crafted object with "__proto__" key', () => {
90+
let a = { b: { c: 1 } };
91+
assert.is(a.polluted, undefined);
92+
assert.is({}.polluted, undefined);
93+
dset(a, "b", JSON.parse('{"__proto__":{"polluted":"Yes!"}}'));
94+
assert.is(a.polluted, undefined);
95+
assert.is({}.polluted, undefined);
96+
});
97+
8898
pollution.run();
8999
}

0 commit comments

Comments
 (0)