Skip to content

Commit

Permalink
Merge pull request #13 from EffectRenan/master
Browse files Browse the repository at this point in the history
Fix XSS vulnerability
  • Loading branch information
huntr.dev | the place to protect open source committed May 3, 2021
2 parents 848283b + b56cbb0 commit 0e71d59
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Backend/Modules/Search/Actions/Statistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,15 @@ private function showDataGrid(): void
public static function parseRefererInDataGrid(string $data): string
{
$data = unserialize($data, ['allowed_classes' => false]);
if (!isset($data['server']['HTTP_REFERER'])) {
return '';
}

$referrer = htmlspecialchars($data['server']['HTTP_REFERER']);
if (isset($data['server']['HTTP_REFERER'])) {
$referrer = $data['server']['HTTP_REFERER'];
if (preg_match('/^(http|https):\/\//', $referrer)) {
$referrer = htmlspecialchars($referrer);
return '<a href="' . $referrer . '">' . $referrer . '</a>';
}
}

return '<a href="' . $referrer . '">' . $referrer . '</a>';
return '';
}
}

0 comments on commit 0e71d59

Please sign in to comment.