mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Avoid merging properties on to __proto__ objects.
This commit is contained in:
15
test/test.js
15
test/test.js
@@ -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);
|
||||
}
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user