Skip to content

Commit

Permalink
Fix potential XSS vulnerability, fixes #564
Browse files Browse the repository at this point in the history
  • Loading branch information
tkrebs committed Oct 7, 2022
1 parent 0f19ee3 commit ef49e70
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions module/Backend/src/Backend/View/Helper/User/UserFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function __invoke(User $user, $search = null)
$user->need('uid'));

$html .= sprintf('<td>%s</td>',
$user->need('alias'));
$view->escapeHtml($user->need('alias')));

$html .= sprintf('<td>%s</td>',
$view->t($user->getStatus()));
Expand Down Expand Up @@ -76,4 +76,4 @@ public function __invoke(User $user, $search = null)
return $html;
}

}
}
4 changes: 2 additions & 2 deletions module/Backend/view/backend/booking/edit-choice.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ $this->setup(array(
<span class="symbolic symbolic-booking">
<b><?= $this->timeRange($reservation->get('time_start'), $reservation->get('time_end'), '%s to %s') ?></b>

<?= $this->t('from') ?> <?= $reservation->getExtra('booking')->getExtra('user')->get('alias') ?>
<?= $this->t('from') ?> <?= $this->escapeHtml($reservation->getExtra('booking')->getExtra('user')->get('alias')) ?>
</span>
</a>
</p>

<?php endforeach; ?>
</div>
</div>
</div>
4 changes: 2 additions & 2 deletions module/Backend/view/backend/booking/players.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $this->setup(array(
printf('<p>%s <a href="%s">%s</a></p>',
$this->translate('Booked by'),
$this->url('backend/user/edit', ['uid' => $this->user->need('uid')]),
$this->user->need('alias'));
$this->escapeHtml($this->user->need('alias')));

echo '<div class="separator separator-line"></div>';

Expand Down Expand Up @@ -63,7 +63,7 @@ $this->setup(array(
$this->translate('User matched by'),
$this->translate(ucfirst($userMatch)),
$this->url('backend/user/edit', ['uid' => $user->need('uid')]),
$user->need('alias'));
$this->escapeHtml($user->need('alias')));
} else {
echo '<td></td>';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __invoke(array $reservations, array $cellLinkParams, Square $squ
$cellLabel = $booking->needExtra('user')->need('alias');
$cellGroup = ' cc-group-' . $booking->need('bid');

return $view->calendarCellLink($cellLabel, $view->url('backend/booking/edit', [], $cellLinkParams), 'cc-free cc-free-partially' . $cellGroup);
return $view->calendarCellLink($view->escapeHtml($cellLabel), $view->url('backend/booking/edit', [], $cellLinkParams), 'cc-free cc-free-partially' . $cellGroup);
} else {
$labelFree = $square->getMeta('label.free', 'Still free');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __invoke(array $reservations, array $cellLinkParams)

switch ($booking->need('status')) {
case 'single':
return $view->calendarCellLink($cellLabel, $view->url('backend/booking/edit', [], $cellLinkParams), 'cc-single' . $cellGroup, null, $cellStyle);
return $view->calendarCellLink($view->escapeHtml($cellLabel), $view->url('backend/booking/edit', [], $cellLinkParams), 'cc-single' . $cellGroup, null, $cellStyle);
case 'subscription':
return $view->calendarCellLink($cellLabel, $view->url('backend/booking/edit', [], $cellLinkParams), 'cc-multiple' . $cellGroup, null, $cellStyle);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ public function __invoke(array $reservations, array $cellLinkParams, Square $squ
$cellLabel = $this->view->t('Occupied');
}

return $view->calendarCellLink($cellLabel, $view->url('square', [], $cellLinkParams), 'cc-single' . $cellGroup);
return $view->calendarCellLink($view->escapeHtml($cellLabel), $view->url('square', [], $cellLinkParams), 'cc-single' . $cellGroup);
case 'subscription':
if (! $cellLabel) {
$cellLabel = $this->view->t('Subscription');
}

return $view->calendarCellLink($cellLabel, $view->url('square', [], $cellLinkParams), 'cc-multiple' . $cellGroup);
return $view->calendarCellLink($view->escapeHtml($cellLabel), $view->url('square', [], $cellLinkParams), 'cc-multiple' . $cellGroup);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions module/Frontend/view/frontend/index/userpanel.online.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<tr>
<td class="responsive-pass-4" style="padding-right: 12px; border-right: solid 1px #CCC;">
<div id="userpanel-status" class="no-wrap">
<?= sprintf($this->t('Online as %s'), $this->user->need('alias')) ?>
<?= sprintf($this->t('Online as %s'), $this->escapeHtml($this->user->need('alias'))) ?>
</div>
</td>

Expand Down Expand Up @@ -36,4 +36,4 @@
<a href="<?= $this->url('service/help') ?>" class="default-button" data-tooltip="<?= sprintf($this->t('Get additional %shelp and information%s'), '<b>', '</b>') ?>"><b>?</b></a>
</td>
</tr>
</table>
</table>

0 comments on commit ef49e70

Please sign in to comment.