diff --git a/framework/web/js/source/jquery.ba-bbq.js b/framework/web/js/source/jquery.ba-bbq.js index ead4ba1bd9..5d8978c5b7 100644 --- a/framework/web/js/source/jquery.ba-bbq.js +++ b/framework/web/js/source/jquery.ba-bbq.js @@ -7,6 +7,13 @@ * https://benalman.com/about/license/ */ +/* + * Additional changes to this file: + * - Removed support for IE8 and below + * - Fixed prototype pollution (CVE-2021-20086) + * - Minified with `uglifyjs jquery.ba-bbq.js --compress -o jquery.ba-bbq.min.js` + */ + // Script: jQuery BBQ: Back Button & Query Library // // *Version: 1.4pre, Last updated: 1/15/2013* @@ -465,7 +472,9 @@ // (Object) An object representing the deserialized params string. $.deparam = jq_deparam = function( params, coerce ) { - var obj = {}, + var prohibitedKeys = ['__proto__']; + + var obj = Object.create(null), coerce_types = { 'true': !0, 'false': !1, 'null': null }; // Iterate over all name=value pairs. @@ -480,6 +489,10 @@ // into its component parts. keys = key.split( '][' ), keys_last = keys.length - 1; + + if ( prohibitedKeys.includes( key ) ) { + return; + } // If the first keys part contains [ and the last ends with ], then [] // are correctly balanced. @@ -521,8 +534,13 @@ // * Rinse & repeat. for ( ; i <= keys_last; i++ ) { key = keys[i] === '' ? cur.length : keys[i]; + + if ( prohibitedKeys.includes( key ) ) { + return; + } + cur = cur[key] = i < keys_last - ? cur[key] || ( keys[i+1] && isNaN( keys[i+1] ) ? {} : [] ) + ? cur[key] || ( keys[i+1] && isNaN( keys[i+1] ) ? Object.create(null) : [] ) : val; } @@ -1017,7 +1035,7 @@ // // hashchange event - https://benalman.com/code/projects/jquery-hashchange/examples/hashchange/ // document.domain - https://benalman.com/code/projects/jquery-hashchange/examples/document_domain/ -// +// // About: Support and Testing // // Information about what version or versions of jQuery this plugin has been @@ -1050,7 +1068,7 @@ // 1.3 - (7/21/2010) Reorganized IE6/7 Iframe code to make it more // "removable" for mobile-only development. Added IE6/7 document.title // support. Attempted to make Iframe as hidden as possible by using -// techniques from https://www.paciellogroup.com/blog/?p=604. Added +// techniques from https://www.paciellogroup.com/blog/?p=604. Added // support for the "shortcut" format $(window).hashchange( fn ) and // $(window).hashchange() like jQuery provides for built-in events. // Renamed jQuery.hashchangeDelay to and @@ -1282,96 +1300,6 @@ timeout_id = setTimeout( poll, $.fn[ str_hashchange ].delay ); }; - // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv - // vvvvvvvvvvvvvvvvvvv REMOVE IF NOT SUPPORTING IE6/7/8 vvvvvvvvvvvvvvvvvvv - // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv - (navigator.userAgent.match(/MSIE/i) !== null) && !supports_onhashchange && (function(){ - // Not only do IE6/7 need the "magical" Iframe treatment, but so does IE8 - // when running in "IE7 compatibility" mode. - - var iframe, - iframe_src; - - // When the event is bound and polling starts in IE 6/7, create a hidden - // Iframe for history handling. - self.start = function(){ - if ( !iframe ) { - iframe_src = $.fn[ str_hashchange ].src; - iframe_src = iframe_src && iframe_src + get_fragment(); - - // Create hidden Iframe. Attempt to make Iframe as hidden as possible - // by using techniques from https://www.paciellogroup.com/blog/?p=604. - iframe = $('