Skip to content

Commit 84c450a

Browse files
authored
Merge pull request #3189 from magento-trigger/PR-2.1.16
[Trigger] Bugfixes
2 parents 4ebfa1d + 9b8d2a0 commit 84c450a

File tree

6 files changed

+97
-29
lines changed

6 files changed

+97
-29
lines changed

app/code/Magento/Theme/view/base/requirejs-config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ var config = {
5656
"mixins": {
5757
"jquery/jstree/jquery.jstree": {
5858
"mage/backend/jstree-mixin": true
59+
},
60+
'jquery': {
61+
'jquery/patches/jquery': true
5962
}
6063
}
6164
}

app/code/Magento/Theme/view/frontend/requirejs-config.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,12 @@ var config = {
4040
"mage/dataPost",
4141
"js/theme",
4242
"mage/bootstrap"
43-
]
43+
],
44+
config: {
45+
mixins: {
46+
'jquery/jquery-ui': {
47+
'jquery/patches/jquery-ui': true
48+
}
49+
}
50+
}
4451
};

lib/web/jquery/patches/jquery-ui.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
define([
7+
'jquery'
8+
], function ($) {
9+
'use strict';
10+
11+
/**
12+
* Patch for CVE-2016-7103 (XSS vulnerability).
13+
* Can safely remove only when jQuery UI is upgraded to >= 1.12.x.
14+
* https://www.cvedetails.com/cve/CVE-2016-7103/
15+
*/
16+
function dialogPatch() {
17+
$.widget('ui.dialog', $.ui.dialog, {
18+
/** @inheritdoc */
19+
_createTitlebar: function () {
20+
this.options.closeText = $('<a>').text('' + this.options.closeText).html();
21+
22+
this._superApply();
23+
},
24+
25+
/** @inheritdoc */
26+
_setOption: function (key, value) {
27+
if (key === 'closeText') {
28+
value = $('<a>').text('' + value).html();
29+
}
30+
31+
this._super(key, value);
32+
}
33+
});
34+
}
35+
36+
return function () {
37+
var majorVersion = $.ui.version.split('.')[0],
38+
minorVersion = $.ui.version.split('.')[1];
39+
40+
if (majorVersion === 1 && minorVersion >= 12 || majorVersion >= 2) {
41+
console.warn('jQuery patch for CVE-2016-7103 is no longer necessary, and should be removed');
42+
}
43+
44+
dialogPatch();
45+
};
46+
});

lib/web/jquery/patches/jquery.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
define([], function () {
7+
'use strict';
8+
9+
/**
10+
* Patch for CVE-2015-9251 (XSS vulnerability).
11+
* Can safely remove only when jQuery UI is upgraded to >= 3.3.x.
12+
* https://www.cvedetails.com/cve/CVE-2015-9251/
13+
*/
14+
function ajaxResponsePatch(jQuery) {
15+
jQuery.ajaxPrefilter(function (s) {
16+
if (s.crossDomain) {
17+
s.contents.script = false;
18+
}
19+
});
20+
}
21+
22+
return function ($) {
23+
var majorVersion = $.fn.jquery.split('.')[0];
24+
25+
$.noConflict();
26+
27+
if (majorVersion >= 3) {
28+
console.warn('jQuery patch for CVE-2015-9251 is no longer necessary, and should be removed');
29+
}
30+
31+
ajaxResponsePatch($);
32+
33+
return $;
34+
};
35+
});

lib/web/mage/translate-inline.js

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -158,33 +158,5 @@
158158
}
159159
});
160160

161-
$.widget('ui.button', $.ui.button, {
162-
_create: function () {
163-
this._super();
164-
/**
165-
* Decode HTML entities to prevent incorrect rendering of dialog button label
166-
*/
167-
this.options.label = this.options.label
168-
? jQuery('<div/>').html(this.options.label).text()
169-
: this.options.label;
170-
/**
171-
* Reset button to make decoded label visible
172-
*/
173-
this._resetButton();
174-
}
175-
});
176-
177-
$.widget('ui.dialog', $.ui.dialog, {
178-
/**
179-
* Prevent rendering of dialog title as escaped HTML
180-
*/
181-
_title: function (title) {
182-
this._super(title);
183-
if (this.options.title) {
184-
title.html(this.options.title);
185-
}
186-
}
187-
});
188-
189161
return $.mage.translateInline;
190162
}));

pub/static/.htaccess

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ Options -MultiViews
2222
RewriteCond %{REQUEST_FILENAME} !-l
2323

2424
RewriteRule .* ../static.php?resource=$0 [L]
25+
# Detects if moxieplayer request with uri params and redirects to uri without params
26+
<Files moxieplayer.swf>
27+
RewriteCond %{QUERY_STRING} !^$
28+
RewriteRule ^(.*)$ %{REQUEST_URI}? [R=301,L]
29+
</Files>
2530
</IfModule>
2631

2732
############################################

0 commit comments

Comments
 (0)