Skip to content

Commit c6979e1

Browse files
committed
MC-10871: [Sec] XSS Injection in HTML Code Content Type
- Update class comments - Move styling for placeholder out of scope
1 parent a1e61f3 commit c6979e1

File tree

3 files changed

+30
-21
lines changed

3 files changed

+30
-21
lines changed

app/code/Magento/PageBuilder/Controller/ContentType/Preview.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212

1313
/**
1414
* Preview controller to render blocks preview on Stage
15+
*
16+
* This isn't placed within the adminhtml folder as it has to extend from the front-end controllers app action to
17+
* ensure the content is rendered in the storefront scope.
18+
*
1519
* @api
1620
*/
1721
class Preview extends \Magento\Framework\App\Action\Action

app/code/Magento/PageBuilder/Plugin/Filter/TemplatePlugin.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public function afterFilter(\Magento\Framework\Filter\Template $subject, string
6464
$this->decodeHtmlContentTypes($document);
6565
}
6666

67+
// If a document was retrieved we've modified the output so need to retrieve it from within the document
6768
if (isset($document)) {
6869
// Match the contents of the body from our generated document
6970
preg_match(
@@ -72,7 +73,7 @@ public function afterFilter(\Magento\Framework\Filter\Template $subject, string
7273
$matches
7374
);
7475

75-
$result = !empty($matches) ? $matches[1] : $result;
76+
return !empty($matches) ? $matches[1] : $result;
7677
}
7778

7879
return $result;

app/code/Magento/PageBuilder/view/adminhtml/web/css/source/content-type/html/_default.less

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,31 @@
1919
justify-content: center;
2020
position: relative;
2121
}
22-
.placeholder-html-code {
23-
background-color: @color-gray98;
24-
font-family: @font-family__console;
25-
font-size: 12px;
26-
font-weight: @font-weight__light;
27-
height: 60px;
28-
overflow: hidden;
29-
position: relative;
30-
word-wrap: break-word;
22+
}
23+
}
3124

32-
&:before {
33-
background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, @color-gray98 100%);
34-
bottom: 0;
35-
content: '';
36-
font-size: 12px;
37-
height: 60px;
38-
left: 0;
39-
position: absolute;
40-
width: 100%;
41-
}
42-
}
25+
.placeholder-html-code {
26+
background-color: @color-gray98;
27+
font-family: @font-family__console;
28+
font-size: 12px;
29+
font-weight: @font-weight__light;
30+
height: 60px;
31+
overflow: hidden;
32+
position: relative;
33+
white-space: pre-wrap;
34+
word-wrap: break-word;
35+
36+
&:before {
37+
background: -moz-linear-gradient(top, rgba(250,250,250,0) 0%, rgba(250,250,250,1) 100%);
38+
background: -webkit-linear-gradient(top, rgba(250,250,250,0) 0%,rgba(250,250,250,1) 100%);
39+
background: linear-gradient(to bottom, rgba(250,250,250,0) 0%,rgba(250,250,250,1) 100%);
40+
bottom: 0;
41+
content: '';
42+
font-size: 12px;
43+
height: 60px;
44+
left: 0;
45+
position: absolute;
46+
width: 100%;
4347
}
4448
}
4549

0 commit comments

Comments
 (0)