fix: prototype pollution in _.defaultsDeep (#4336)

This commit is contained in:
Kirill
2019-06-24 19:17:55 +03:00
committed by John-David Dalton
parent e42cd97dae
commit 1f8ea07746
2 changed files with 16 additions and 1 deletions

View File

@@ -4712,6 +4712,17 @@
var actual = _.defaultsDeep({ 'a': ['abc'] }, { 'a': 'abc' });
assert.deepEqual(actual.a, ['abc']);
});
QUnit.test('should not indirectly merge `Object` properties', function(assert) {
assert.expect(1);
_.defaultsDeep({}, { 'constructor': { 'a': 1 } });
var actual = 'a' in Object;
delete Object.a;
assert.notOk(actual);
});
}());
/*--------------------------------------------------------------------------*/