Skip to content

Commit 95af0e8

Browse files
author
Francois Suter
committed
[BUGFIX] Improve/escape output of HTML in key, message and extra_data fields
Resolves #2. Change-Id: Iede72db43653c5b582a309a5b850f961fd7201e3
1 parent bca1cda commit 95af0e8

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2016-11-15 Francois Suter <[email protected]>
2+
3+
* Improved escaping of HTML content in log entries, resolves #2
4+
15
2016-11-13 Francois Suter <[email protected]>
26

37
* Verified compatibility with TYPO3 v8 (8.5.-dev), resolves #78626

Classes/Domain/Repository/EntryRepository.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,9 @@ protected function expandEntryData(array $entries)
378378
if ($numEntries > 0) {
379379
$users = $this->findAllUsers();
380380
for ($i = 0; $i < $numEntries; $i++) {
381+
// Escape potentially malign data
382+
$entries[$i]['key'] = htmlspecialchars($entries[$i]['key']);
383+
$entries[$i]['message'] = htmlspecialchars($entries[$i]['message']);
381384
// Grab username instead of id
382385
$userId = (int)$entries[$i]['cruser_id'];
383386
if ($userId > 0 && isset($users[$userId])) {
@@ -405,12 +408,12 @@ protected function expandEntryData(array $entries)
405408
$entries[$i]['page'] = $pageTitle;
406409
$pageInformationCache[$pid] = $pageTitle;
407410
}
408-
// Process extra data (uncompress and dump)
411+
// Process extra data (uncompress, dump and escape)
409412
if ($entries[$i]['extra_data'] === '') {
410413
$extraData = '';
411414
} else {
412415
$extraData = gzuncompress($entries[$i]['extra_data']);
413-
$extraData = var_export(unserialize($extraData), true);
416+
$extraData = htmlspecialchars(var_export(unserialize($extraData), true));
414417
}
415418
$entries[$i]['extra_data'] = $extraData;
416419
}

Classes/Utility/Logger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function log($logData)
119119
$this->counter++;
120120
$entry->setCrdate(time());
121121
$entry->setMessage(
122-
GeneralUtility::removeXSS($logData['msg'])
122+
strip_tags($logData['msg'])
123123
);
124124
$entry->setExtkey(
125125
strip_tags($logData['extKey'])

Classes/Utility/UserFields.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function displayExtraData($PA, $formObject)
9090
$data,
9191
true
9292
);
93-
$html = '<pre>' . $html . '</pre>';
93+
$html = '<pre>' . htmlspecialchars($html) . '</pre>';
9494
} else {
9595
$html = DebuggerUtility::var_dump(
9696
$data,

0 commit comments

Comments
 (0)