Skip to content

Commit 72f45dd

Browse files
authored
Fix Xss in the segment name (#490)
* Fix Xss in the segment name * Apply php-cs-fixer changes * Fix PHP stan --------- Co-authored-by: aryaantony92 <[email protected]>
1 parent 465d227 commit 72f45dd

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"pear/archive_tar": "^1.4.3",
2525
"pimcore/number-sequence-generator": "^1.0.5",
2626
"pimcore/object-merger": "^3.0",
27-
"pimcore/pimcore": "^10.5",
27+
"pimcore/pimcore": "^10.5.21",
2828
"pimcore/search-query-parser": "^1.3",
2929
"symfony/asset": "^5.3",
3030
"symfony/config": "^5.3",

src/View/Formatter/DefaultViewFormatter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use CustomerManagementFrameworkBundle\Model\CustomerSegmentInterface;
2020
use Pimcore\Model\DataObject\ClassDefinition;
2121
use Pimcore\Model\DataObject\ClassDefinition\Data;
22+
use Pimcore\Security\SecurityHelper;
2223
use Symfony\Contracts\Translation\TranslatorInterface;
2324

2425
class DefaultViewFormatter implements ViewFormatterInterface
@@ -176,7 +177,7 @@ public function getLocale()
176177
*/
177178
protected function formatSegmentValue(CustomerSegmentInterface $segment)
178179
{
179-
return sprintf('<span class="label label-default">%s</span>', $segment->getName());
180+
return sprintf('<span class="label label-default">%s</span>', SecurityHelper::convertHtmlSpecialChars($segment->getName()));
180181
}
181182

182183
protected function getLanguageFromLocale($locale)

0 commit comments

Comments
 (0)