File tree 2 files changed +37
-0
lines changed
2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 3990
3990
var key = toKey(path[index]),
3991
3991
newValue = value;
3992
3992
3993
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
3994
+ return object;
3995
+ }
3996
+
3993
3997
if (index != lastIndex) {
3994
3998
var objValue = nested[key];
3995
3999
newValue = customizer ? customizer(objValue, key, nested) : undefined;
Original file line number Diff line number Diff line change 25799
25799
});
25800
25800
});
25801
25801
25802
+ // zipObjectDeep prototype pollution
25803
+ ['__proto__', 'constructor', 'prototype'].forEach(function (keyToTest) {
25804
+ QUnit.test('zipObjectDeep is not setting ' + keyToTest + ' on global', function (assert) {
25805
+ assert.expect(1);
25806
+
25807
+ _.zipObjectDeep([keyToTest + '.a'], ['newValue']);
25808
+ // Can't access plain `a` as it's not defined and test fails
25809
+ assert.notEqual(root['a'], 'newValue');
25810
+ });
25811
+
25812
+ QUnit.test('zipObjectDeep is not overwriting ' + keyToTest + ' on vars', function (assert) {
25813
+ assert.expect(3);
25814
+
25815
+ const b = 'oldValue'
25816
+ _.zipObjectDeep([keyToTest + '.b'], ['newValue']);
25817
+ assert.equal(b, 'oldValue');
25818
+ assert.notEqual(root['b'], 'newValue');
25819
+
25820
+ // ensure nothing was created
25821
+ assert.notOk(root['b']);
25822
+ });
25823
+
25824
+ QUnit.test('zipObjectDeep is not overwriting global.' + keyToTest, function (assert) {
25825
+ assert.expect(2);
25826
+
25827
+ _.zipObjectDeep([root + '.' + keyToTest + '.c'], ['newValue']);
25828
+ assert.notEqual(root['c'], 'newValue');
25829
+
25830
+ // ensure nothing was created
25831
+ assert.notOk(root['c']);
25832
+ });
25833
+ });
25834
+
25802
25835
/*--------------------------------------------------------------------------*/
25803
25836
25804
25837
QUnit.module('lodash.zipWith');
You can’t perform that action at this time.
0 commit comments