Skip to content

Commit

Permalink
Fix XSS vulnerability in tag search
Browse files Browse the repository at this point in the history
It affect the title tag of the bookmark list page.
Fixes #2038
  • Loading branch information
ArthurHoaro committed Nov 22, 2023
1 parent ca07f26 commit 5553783
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ public function index(Request $request, Response $response): Response
$tagsSeparator = $this->container->conf->get('general.tags_separator', ' ');
$searchTagsUrlEncoded = array_map('urlencode', tags_str2array($searchTags, $tagsSeparator));
$searchTags = !empty($searchTags) ? trim($searchTags, $tagsSeparator) . $tagsSeparator : '';

$searchTags = !empty($searchTags) ? escape($searchTags) : '';
$searchTerm = !empty($searchTerm) ? escape($searchTerm) : '';

// Fill all template fields.
$data = array_merge(
Expand All @@ -91,8 +94,8 @@ public function index(Request $request, Response $response): Response
'page_current' => $page,
'page_max' => $searchResult->getLastPage(),
'result_count' => $searchResult->getTotalCount(),
'search_term' => escape($searchTerm),
'search_tags' => escape($searchTags),
'search_term' => $searchTerm,
'search_tags' => $searchTags,
'search_tags_url' => $searchTagsUrlEncoded,
'visibility' => $visibility,
'links' => $links,
Expand Down

0 comments on commit 5553783

Please sign in to comment.