Avoid merging properties on to __proto__ objects.

This commit is contained in:
John-David Dalton
2018-01-30 23:21:12 -08:00
parent 5a3ff73997
commit d8e069cc34
2 changed files with 32 additions and 3 deletions

View File

@@ -7539,6 +7539,21 @@
actual = _.groupBy([{ 'a': '__proto__' }], 'a');
assert.notOk(actual instanceof Array);
});
QUnit.test('should not merge "__proto__" properties', function(assert) {
assert.expect(1);
if (JSON) {
_.merge({}, JSON.parse('{"__proto__":{"a":1}}'));
var actual = "a" in objectProto;
delete objectProto.a;
assert.notOk(actual);
} else {
skipAssert(assert);
}
});
}());
/*--------------------------------------------------------------------------*/