Bug 26102: [19.11] Prevent XSS when To.json is used: catalogue/results.tt

To test, perform a search in the catalogue and verify that search term
highlighting works correctly.

Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
This commit is contained in:
Owen Leonard 2020-08-11 12:57:48 +00:00 committed by Wainui Witika-Park
parent 8401cd292c
commit 3c3237ca87
1 changed files with 2 additions and 1 deletions

View File

@ -1,5 +1,6 @@
[% USE raw %]
[% USE Asset %]
[% USE To %]
[% USE Koha %]
[% USE Biblio %]
[% USE KohaDates %]
@ -772,7 +773,7 @@
[% IF ( query_desc ) %]
toHighlight = $("p,span.results_summary,a.title");
var query_desc = "[% query_desc |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]";
var query_desc = "[% To.json( query_desc ) | html %]",
q_array = query_desc.split(" ");
// ensure that we don't have "" at the end of the array, which can
// break the highlighter