11/**
22 * @license
33 * Lodash (Custom Build) <https://lodash.com/>
4- * Build: `lodash strict include="omit,uniq,uniqBy,uniqWith,intersection,intersectionBy,intersectionWith,pick,pickBy,debounce,throttle,max,min,castArray,curry,merge,mergeWith,toArray,xor,xorBy,xorWith,isNil,difference,differenceBy,differenceWith,flatMap,flatMapDeep,flatMapDepth,isEqual,isEqualWith,without,flatten,flattenDeep,flattenDepth,compact,zipObject,zipObjectDeep,union,unionBy,unionWith "`
4+ * Build: `lodash strict include="castArray,compact,curry,debounce,difference,differenceBy,differenceWith,flatMap,flatMapDeep,flatMapDepth,flatten,flattenDeep,flattenDepth,intersection,intersectionBy,intersectionWith,isEqual,isEqualWith,isNil,max,merge,mergeWith,min,omit,pick,pickBy,throttle,toArray,union,unionBy,unionWith,uniq,uniqBy,uniqWith,without,xor,xorBy,xorWith,zipObject,zipObjectDeep "`
55 * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
66 * Released under MIT license <https://lodash.com/license>
77 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@@ -20,7 +20,7 @@ sap.ui.define(function() {
2020 var undefined ;
2121
2222 /** Used as the semantic version number. */
23- var VERSION = '4.17.21 ' ;
23+ var VERSION = '4.17.23 ' ;
2424
2525 /** Used as the size to enable large array optimizations. */
2626 var LARGE_ARRAY_SIZE = 200 ;
@@ -2750,8 +2750,47 @@ sap.ui.define(function() {
27502750 */
27512751 function baseUnset ( object , path ) {
27522752 path = castPath ( path , object ) ;
2753- object = parent ( object , path ) ;
2754- return object == null || delete object [ toKey ( last ( path ) ) ] ;
2753+
2754+ // Prevent prototype pollution, see: https://github.com/lodash/lodash/security/advisories/GHSA-xxjr-mmjv-4gpg
2755+ var index = - 1 ,
2756+ length = path . length ;
2757+
2758+ if ( ! length ) {
2759+ return true ;
2760+ }
2761+
2762+ var isRootPrimitive = object == null || ( typeof object !== 'object' && typeof object !== 'function' ) ;
2763+
2764+ while ( ++ index < length ) {
2765+ var key = path [ index ] ;
2766+
2767+ // skip non-string keys (e.g., Symbols, numbers)
2768+ if ( typeof key !== 'string' ) {
2769+ continue ;
2770+ }
2771+
2772+ // Always block "__proto__" anywhere in the path if it's not expected
2773+ if ( key === '__proto__' && ! hasOwnProperty . call ( object , '__proto__' ) ) {
2774+ return false ;
2775+ }
2776+
2777+ // Block "constructor.prototype" chains
2778+ if ( key === 'constructor' &&
2779+ ( index + 1 ) < length &&
2780+ typeof path [ index + 1 ] === 'string' &&
2781+ path [ index + 1 ] === 'prototype' ) {
2782+
2783+ // Allow ONLY when the path starts at a primitive root, e.g., _.unset(0, 'constructor.prototype.a')
2784+ if ( isRootPrimitive && index === 0 ) {
2785+ continue ;
2786+ }
2787+
2788+ return false ;
2789+ }
2790+ }
2791+
2792+ var obj = parent ( object , path ) ;
2793+ return obj == null || delete obj [ toKey ( last ( path ) ) ] ;
27552794 }
27562795
27572796 /**
0 commit comments