Skip to content

Commit 224ef2d

Browse files
committed
MAGETWO-81507: Stored XSS in Product SKU field of Magento 2.2 EE
1 parent 0f61d2d commit 224ef2d

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

app/code/Magento/Catalog/view/frontend/templates/product/list.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output');
7777
<div class="actions-primary"<?= strpos($pos, $viewMode . '-primary') ? $position : '' ?>>
7878
<?php if ($_product->isSaleable()): ?>
7979
<?php $postParams = $block->getAddToCartPostParams($_product); ?>
80-
<form data-role="tocart-form" data-product-sku="<?= /* @NoEscape */ $_product->getSku() ?>" action="<?= /* @NoEscape */ $postParams['action'] ?>" method="post">
80+
<form data-role="tocart-form" data-product-sku="<?= $block->escapeHtml($_product->getSku()) ?>" action="<?= /* @NoEscape */ $postParams['action'] ?>" method="post">
8181
<input type="hidden" name="product" value="<?= /* @escapeNotVerified */ $postParams['data']['product'] ?>">
8282
<input type="hidden" name="<?= /* @escapeNotVerified */ Action::PARAM_NAME_URL_ENCODED ?>" value="<?= /* @escapeNotVerified */ $postParams['data'][Action::PARAM_NAME_URL_ENCODED] ?>">
8383
<?= $block->getBlockHtml('formkey') ?>

app/code/Magento/Catalog/view/frontend/templates/product/view/form.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<?php $_product = $block->getProduct(); ?>
1717

1818
<div class="product-add-form">
19-
<form data-product-sku="<?= /* @NoEscape */ $_product->getSku() ?>"
19+
<form data-product-sku="<?= $block->escapeHtml($_product->getSku()) ?>"
2020
action="<?= /* @NoEscape */ $block->getSubmitUrl($_product) ?>" method="post"
2121
id="product_addtocart_form"<?php if ($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
2222
<input type="hidden" name="product" value="<?= /* @escapeNotVerified */ $_product->getId() ?>" />

app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ $canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinima
9090
<div class="control qty">
9191
<input id="cart-<?= /* @escapeNotVerified */ $_item->getId() ?>-qty"
9292
name="cart[<?= /* @escapeNotVerified */ $_item->getId() ?>][qty]"
93-
data-cart-item-id="<?= /* @escapeNotVerified */ $_item->getSku() ?>"
93+
data-cart-item-id="<?= $block->escapeHtml($_item->getSku()) ?>"
9494
value="<?= /* @escapeNotVerified */ $block->getQty() ?>"
9595
type="number"
9696
size="4"

0 commit comments

Comments
 (0)