Skip to content

Commit

Permalink
Fix XSS in name parameter of Pricing Rules (#14969)
Browse files Browse the repository at this point in the history
  • Loading branch information
aryaantony92 committed Apr 19, 2023
1 parent d00489a commit e88fa79
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
5 changes: 2 additions & 3 deletions bundles/EcommerceFrameworkBundle/PricingManager/Rule.php
Expand Up @@ -24,7 +24,7 @@
use Pimcore\Logger;
use Pimcore\Model\AbstractModel;
use Pimcore\Model\Exception\NotFoundException;

use Pimcore\Security\SecurityHelper;
/**
* @method Dao getDao()
*/
Expand Down Expand Up @@ -204,8 +204,7 @@ public function getName()
*/
public function setName($name, $locale = null)
{
$this->name = $name;

$this->name = SecurityHelper::convertHtmlSpecialChars($name);
return $this;
}

Expand Down
Expand Up @@ -295,17 +295,21 @@ pimcore.bundle.EcommerceFramework.pricing.config.panel = Class.create({
* delete existing rule
*/
deleteRule: function (tree, record) {
pimcore.helpers.deleteConfirm(t('bundle_ecommerce_pricing_rule'), record.data.text, function () {
Ext.Ajax.request({
url: Routing.generate('pimcore_ecommerceframework_pricing_delete'),
method: 'DELETE',
params: {
id: record.id
},
success: function () {
this.refresh(this.tree.getRootNode());
}.bind(this)
});
const decodedName = Ext.util.Format.htmlDecode(record.data.text);
pimcore.helpers.deleteConfirm(
t('bundle_ecommerce_pricing_rule'),
Ext.util.Format.htmlEncode(decodedName),
function () {
Ext.Ajax.request({
url: Routing.generate('pimcore_ecommerceframework_pricing_delete'),
method: 'DELETE',
params: {
id: record.id
},
success: function () {
this.refresh(this.tree.getRootNode());
}.bind(this)
});
}.bind(this));

},
Expand Down

0 comments on commit e88fa79

Please sign in to comment.