From 6ed45bb43e2d30b50eda633cc1ba7ad0bcb48b54 Mon Sep 17 00:00:00 2001 From: Matthias Kunnen Date: Tue, 21 Jul 2020 03:28:42 +0000 Subject: [PATCH] Test prototype pollution on unflatten --- test/test.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/test.js b/test/test.js index 541c9d7..1835440 100644 --- a/test/test.js +++ b/test/test.js @@ -470,6 +470,20 @@ suite('Unflatten', function () { }) }) } + + test('should not pollute prototype', function () { + unflatten({ + '__proto__.polluted': true + }); + unflatten({ + 'prefix.__proto__.polluted': true + }); + unflatten({ + 'prefix.0.__proto__.polluted': true + }); + + assert.notStrictEqual({}.polluted, true); + }) }) suite('Arrays', function () {