@@ -40365,7 +40365,7 @@ module.exports = keysIn;
4036540365 var undefined;
4036640366
4036740367 /** Used as the semantic version number. */
40368- var VERSION = '4.17.21 ';
40368+ var VERSION = '4.17.23 ';
4036940369
4037040370 /** Used as the size to enable large array optimizations. */
4037140371 var LARGE_ARRAY_SIZE = 200;
@@ -44119,7 +44119,7 @@ module.exports = keysIn;
4411944119 if (isArray(iteratee)) {
4412044120 return function(value) {
4412144121 return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
44122- }
44122+ };
4412344123 }
4412444124 return iteratee;
4412544125 });
@@ -44723,8 +44723,47 @@ module.exports = keysIn;
4472344723 */
4472444724 function baseUnset(object, path) {
4472544725 path = castPath(path, object);
44726- object = parent(object, path);
44727- return object == null || delete object[toKey(last(path))];
44726+
44727+ // Prevent prototype pollution, see: https://github.com/lodash/lodash/security/advisories/GHSA-xxjr-mmjv-4gpg
44728+ var index = -1,
44729+ length = path.length;
44730+
44731+ if (!length) {
44732+ return true;
44733+ }
44734+
44735+ var isRootPrimitive = object == null || (typeof object !== 'object' && typeof object !== 'function');
44736+
44737+ while (++index < length) {
44738+ var key = path[index];
44739+
44740+ // skip non-string keys (e.g., Symbols, numbers)
44741+ if (typeof key !== 'string') {
44742+ continue;
44743+ }
44744+
44745+ // Always block "__proto__" anywhere in the path if it's not expected
44746+ if (key === '__proto__' && !hasOwnProperty.call(object, '__proto__')) {
44747+ return false;
44748+ }
44749+
44750+ // Block "constructor.prototype" chains
44751+ if (key === 'constructor' &&
44752+ (index + 1) < length &&
44753+ typeof path[index + 1] === 'string' &&
44754+ path[index + 1] === 'prototype') {
44755+
44756+ // Allow ONLY when the path starts at a primitive root, e.g., _.unset(0, 'constructor.prototype.a')
44757+ if (isRootPrimitive && index === 0) {
44758+ continue;
44759+ }
44760+
44761+ return false;
44762+ }
44763+ }
44764+
44765+ var obj = parent(object, path);
44766+ return obj == null || delete obj[toKey(last(path))];
4472844767 }
4472944768
4473044769 /**
0 commit comments