Skip to content

Commit 0b4871f

Browse files
authored
Merge pull request #40 from webmatch/hotfix/WBMSWPLUG-66-fix-xss
[HOTFIX][WBMSWPLUG-66] fix xss in datalayer
2 parents 09c71a0 + 44026a8 commit 0b4871f

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## [3.5.1]
2+
- Fix XSS security breach over site search term
3+
14
## [3.5.0]
25
- Add product click tracking support
36

Services/TagManagerVariables.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,21 @@ public function fillValues($dataLayer)
173173
*/
174174
public function prependDataLayer($source, $prettyPrint = false)
175175
{
176+
$variables = $this->getVariables();
177+
178+
array_walk_recursive($variables, static function (&$item) {
179+
$item = htmlspecialchars($item);
180+
});
181+
176182
return sprintf(
177183
'%s%s%s%s',
178184
'<script>',
179185
sprintf(
180186
'window.dataLayer.push(%s);',
181-
json_encode(
182-
$this->getVariables(),
183-
($prettyPrint) ? JSON_PRETTY_PRINT : null
184-
)
187+
json_encode(
188+
$variables,
189+
($prettyPrint) ? JSON_PRETTY_PRINT : null
190+
)
185191
),
186192
'</script>',
187193
$source

plugin.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@
33
<label lang="de">Tag Manager</label>
44
<label lang="en">Tag Manager</label>
55

6-
<version>3.5.0</version>
6+
<version>3.5.1</version>
77
<link>http://www.webmatch.de</link>
88
<author>Webmatch GmbH</author>
99
<compatibility minVersion="5.6.3" />
1010

11+
<changelog version="3.5.1">
12+
<changes lang="de">Behebt XSS Sicherheitslücke über den Suchbegriff auf der Suchseite</changes>
13+
<changes lang="en">Fix XSS security breach over site search term</changes>
14+
</changelog>
15+
1116
<changelog version="3.5.0">
1217
<changes lang="de">Hinzufügen der Möglichkeit des tracken von Produktklicks</changes>
1318
<changes lang="en">Add possibility to track product clicks</changes>

0 commit comments

Comments
 (0)