Skip to content

Commit 40b510e

Browse files
committed
Merge remote-tracking branch 'origin/MC-13104' into 2.3-develop-pr75
2 parents 77b57e1 + 9d8128e commit 40b510e

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,11 @@
512512
<requiredEntity type="product_option">ProductOptionArea</requiredEntity>
513513
<requiredEntity type="product_option">ProductOptionFile</requiredEntity>
514514
</entity>
515+
<entity name="ProductFileOptionWithScriptTag" type="product">
516+
<var key="sku" entityType="product" entityKey="sku"/>
517+
<data key="file">&lt;img src=x onerror='alert("XSS without &lt;script&gt;&lt;:script&gt; tags...")'&gt;.png</data>
518+
<requiredEntity type="product_option">ProductOptionFile</requiredEntity>
519+
</entity>
515520
<entity name="ApiVirtualProductWithDescription" type="product">
516521
<data key="sku" unique="suffix">api-virtual-product</data>
517522
<data key="type_id">virtual</data>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontVerifyCannotLoadFileWithIncorrectNameThroughCustomOptionsTest">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<stories value="Custom options"/>
15+
<title value="Verify cannot load file with incorrect name through Custom options"/>
16+
<description value="Verify cannot load file with incorrect name through Custom options"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-13104"/>
19+
<group value="catalog"/>
20+
</annotations>
21+
<before>
22+
<!-- Create customer -->
23+
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
24+
<!-- Create category -->
25+
<createData entity="_defaultCategory" stepKey="createCategory"/>
26+
<!-- Create simple product -->
27+
<createData entity="_defaultProduct" stepKey="createProduct">
28+
<requiredEntity createDataKey="createCategory"/>
29+
</createData>
30+
<!-- Add file upload custom option to the product -->
31+
<updateData createDataKey="createProduct" entity="ProductFileOptionWithScriptTag" stepKey="updateProductWithOption"/>
32+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/>
33+
</before>
34+
<after>
35+
<!-- Delete product -->
36+
<deleteData createDataKey="createProduct" stepKey="deleteSimpleProduct"/>
37+
<!-- Delete category -->
38+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
39+
<!-- Delete customer -->
40+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
41+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/>
42+
</after>
43+
44+
<!-- Login to storefront -->
45+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsCustomer">
46+
<argument name="Customer" value="$$createCustomer$$"/>
47+
</actionGroup>
48+
49+
<!-- Open product page -->
50+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="openProductPage">
51+
<argument name="productUrlKey" value="$$createProduct.custom_attributes[url_key]$$"/>
52+
</actionGroup>
53+
54+
<!-- Upload file -->
55+
<actionGroup ref="StorefrontAttachOptionFileActionGroup" stepKey="selectAndAttachFile">
56+
<argument name="optionTitle" value="ProductOptionFile"/>
57+
<argument name="file" value="ProductFileOptionWithScriptTag.file"/>
58+
</actionGroup>
59+
60+
<!-- Add product to cart -->
61+
<click selector="{{StorefrontProductInfoMainSection.AddToCart}}" stepKey="clickAddToCartButton"/>
62+
<waitForPageLoad stepKey="waitForProductAddToCart"/>
63+
64+
<!-- Assert alert message -->
65+
<waitForElementVisible selector="{{StorefrontProductPageSection.alertMessage}}" stepKey="waitForElementVisible"/>
66+
<see selector="{{StorefrontProductPageSection.alertMessage}}" userInput="The file is empty. Select another file and try again." stepKey="seeAlertMessage"/>
67+
68+
<!-- Assert cart is empty -->
69+
<actionGroup ref="assertMiniCartEmpty" stepKey="assertMiniCartEmpty"/>
70+
</test>
71+
</tests>

dev/tests/acceptance/tests/_data/<img src=x onerror='alert("XSS without <script><:script> tags...")'>.png

Loading

0 commit comments

Comments
 (0)