]> git.koha-community.org Git - koha.git/commit
Bug 13789 - facets with accented utf-8 characters generate double encoded links
authorDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 4 Mar 2015 10:38:42 +0000 (11:38 +0100)
committerChris Cormack <chrisc@catalyst.net.nz>
Thu, 12 Mar 2015 07:24:37 +0000 (20:24 +1300)
commit0029619eb3838eb372eca87b8eb3e6ca1a3a4629
tree0e21d93945247f671faf1384a2cf5c484135a5c9
parent8a2cccc8dfa07ad6a731554d523fb5aab1540943
Bug 13789 - facets with accented utf-8 characters generate double encoded links

Bug 13425 tried to fix XSS in OPAC, by using url filter in template toolkit
on whole generated url. This doesn't work and create double encoded strings
in facets because we are creating url variable by concatenating query_cgi
(which did pass through uri_escape_utf8 on perl side) and other
parameters which have to be escaped in template.

Also, code like

[% SET limit_cgi_f = limit_cgi | url %]

doesn't do anything (at least doesn't apply url filter) so it's not needed.

This patch also fixes encoding of hidden fields used in sort by form.

And lastly, it tries to make facet changes for opac and intranet as same as
possible to simplify future maintencence of this code.

Test scenario:
1. find results in your opac which contain accented characters
2. click on them and verify that results are missing
3. apply this patch
4. re-run search and click on facets link verifying that there are
   now results
5. test sort by form and verify that results are ok
6. verify that facets are still safe from injection by constructing url like
   /cgi-bin/koha/opac-search.pl?q=123&sort_by='"><script>prompt('Happy_Holidays')</script>&limit=123
   and verifying that you DON'T see prompt window in your browser

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
(cherry picked from commit 1ca9adaa56ff809a76ff903bb231175d0195163c)
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Conflicts:
koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc
catalogue/search.pl
koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc
koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc
opac/opac-search.pl