Skip to content

Commit 21dbf9d

Browse files
committed
MC-10871: [Sec] XSS Injection in HTML Code Content Type
- Fix MFTF failures
1 parent 261f3da commit 21dbf9d

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

app/code/Magento/PageBuilder/Model/Stage/HtmlFilter.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,14 @@ public function filterHtml(string $content): string
5454
$item->parentNode->removeChild($item);
5555
}
5656
$xpath = new \DOMXPath($dom);
57-
$htmlContentTypes = $xpath->query('//*[@data-role="html"]');
57+
$htmlContentTypes = $xpath->query('//*[@data-role="html" and not(contains(@class, "placeholder-html-code"))]');
5858
foreach ($htmlContentTypes as $htmlContentType) {
5959
/* @var \DOMElement $htmlContentType */
6060
$innerHTML= '';
6161
$children = $htmlContentType->childNodes;
6262
foreach ($children as $child) {
6363
$innerHTML .= $child->ownerDocument->saveXML($child);
6464
}
65-
$htmlContentType->removeAttribute("data-role");
6665
$htmlContentType->setAttribute(
6766
"class",
6867
$htmlContentType->getAttribute("class") . " placeholder-html-code"

app/code/Magento/PageBuilder/Test/Mftf/Section/PageBuilderBlockSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="BlockOnStage">
12-
<element name="html" type="text" selector="((//div[contains(@class,'pagebuilder-block')])[{{arg1}}]//div[contains(@data-bind,'html: data.main.html')])[{{arg2}}]//a[contains(@class,'pagebuilder-button-primary')]" parameterized="true"/>
12+
<element name="html" type="text" selector="((//div[contains(@class,'pagebuilder-block')])[{{arg1}}]//div[contains(@data-bind,'html: data.main.html')])[{{arg2}}]//div[contains(@class,'placeholder-html-code')]" parameterized="true"/>
1313
<element name="status" type="text" selector="((//div[contains(@class,'pagebuilder-block')])[{{arg1}}]//span[contains(@class,'placeholder') and text()='{{arg}}'])" parameterized="true"/>
1414
<element name="deleted" type="text" selector="((//div[contains(@class,'pagebuilder-block')])[{{arg1}}]//span[contains(@class,'placeholder') and contains(text(),'Block with ID: {{arg}} doesn')])" parameterized="true"/>
1515
<element name="title" type="text" selector="(//div[contains(@class,'pagebuilder-block')])[{{arg1}}]//div[contains(@class,'pagebuilder-options-wrapper')]//div[contains(@class,'option-title') and text()='{{arg}}']" parameterized="true"/>

app/code/Magento/PageBuilder/Test/Mftf/Test/AdminPageBuilderBlockTest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@
172172
<comment userInput="Validate stage after updating block" stepKey="validateStage2" />
173173
<actionGroup ref="switchToPageBuilderStage" stepKey="switchToPageBuilderStage"/>
174174
<waitForElementVisible selector="{{HtmlOnStage.base('1')}}" stepKey="waitForHtmlBaseStage1"/>
175-
<waitForElementVisible selector="{{BlockOnStage.html('1', '1')}}" stepKey="waitForHtmlStage1"/>
175+
<see selector="{{BlockOnStage.html('1', '1')}}" userInput="{{PageBuilderHtmlPropertyButton.value}}" stepKey="waitForHtmlStage1"/>
176176
<actionGroup ref="ClearCacheActionGroup" stepKey="clearMagentoCache"/>
177177
<!-- Validate Storefront -->
178178
<comment userInput="Validate storefront after updating block" stepKey="validateStorefront2" />
@@ -1475,7 +1475,7 @@
14751475
</actionGroup>
14761476
</before>
14771477
<after>
1478-
<deleteData createDataKey="createPreReqBlock" stepKey="deletePreReqBlock" />
1478+
<!--<deleteData createDataKey="createPreReqBlock" stepKey="deletePreReqBlock" />-->
14791479
<actionGroup ref="logout" stepKey="logout"/>
14801480
</after>
14811481
<!-- Edit Block and configure Row - Vertical Align Bottom -->

0 commit comments

Comments
 (0)