Koha/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-review.tt
Jonathan Druart dcd1f5d48c Bug 13618: Add html filters to all the variables
Here we go, next step then.
As we did not fix the performance issue when autofiltering
the variables (see bug 20975), the only solution we have is to add the
filters explicitely.

This patch has been autogenerated (using add_html_filters.pl, see next
pathces) and add the html filter to all the variables displayed in the
template.
Exceptions are made (using the new 'raw' TT filter) to the variable we
already listed in the previous versions of this patch.

To test:
- Use t/db_dependent/Koha/Patrons.t to populate your DB with autogenerated
data which contain <script> tags

- Remove them from borrower_debarments.comments (there are allowed here)
update  borrower_debarments set comment="html tags possible here";

- From the interface hit page and try to catch alert box.
If you find one it means you find a possible XSS.
To know where it comes from:
* note the exact URL where you found it
* note the alert box content
* Dump your DB and search for the string in the dump to identify its
location (for instance table.field)

Next:
* Ideally we would like to use the raw filter when it is not necessary
to HTML escape the variables (in big loop for instance)
* Provide a QA script to catch missing filters (we want html, uri, url
or raw, certainly others that I am forgetting now)
* Replace the html filters with uri when needed (!)

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-08-17 15:55:05 +00:00

77 lines
4 KiB
Text

[% INCLUDE 'doc-head-open.inc' %]
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo; Comments on [% title | html %]</title>
<style>
#custom-doc { width:37.08em;*width:36.16em;min-width:485px; margin:1em auto; text-align:left; }
</style>
[% INCLUDE 'doc-head-close.inc' %]
[% BLOCK cssinclude %][% END %]
</head>
[% INCLUDE 'bodytag.inc' bodyid='comment' bodyclass='popup' %]
<div class="main">
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div id="userreview">
[% IF ( cgi_debug ) %]
<div class="debug">CGI debug is on.</div>
[% END %]
[% IF ( ERRORS ) %]
<div class="alert">
[% FOREACH ERROR IN ERRORS %]
[% IF ( ERROR.nobiblio ) %]
<p>Error: we cannot find this bibliographic record.</p>
[% END %]
[% IF ( ERROR.unauthorized ) %]
<p>Sorry, only the creator of this comment is allowed to change it.</p>
[% END %]
[% IF ( ERROR.scrubbed ) %]
<p>Note: your comment contained illegal markup code. It has been saved with the markup removed, as below. You can edit the comment further, or cancel to retain the comment as is.</p>
[% END %]
[% IF ( ERROR.scrubbed_all ) %]
<p>Error! Your comment was entirely illegal markup code. It has NOT been added.</p>
[% END %]
[% IF ( ERROR.empty ) %]
<p>Error! You cannot add an empty comment. Please add content or cancel.</p>
[% END %]
[% END # / FOREACH ERROR %]
[% IF ( WINDOW_CLOSE ) %]
Note: this window will close automatically in 5 seconds.
[% END %]
</div>
[% END # / ERRORs %]
<h1>Comments on <i>[% title | html %] [% subtitle | html %]</i></h1>
[% IF ( author ) %]<h3>[% author | html %]</h3>[% END %]
<form id="reviewf" action="/cgi-bin/koha/opac-review.pl[% IF ( cgi_debug ) %]?debug=1[% END %]" method="post">
<input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
[% IF ( reviewid ) %]<input type="hidden" name="reviewid" value="[% reviewid | html %]" />[% END %]
<fieldset>
<textarea id="review" name="review" cols="60" rows="8">[% review | html %]</textarea>
</fieldset>
<p>Note: Your comment must be approved by a librarian. </p>
<fieldset class="action">
<input type="submit" class="btn" value="Submit and close this window" />
<a class="cancel close" href="#">Cancel</a>
</fieldset>
</form>
</div> <!-- / #usersendshelfform -->
</div> <!-- / .span12 -->
</div> <!-- / .row-fluid -->
</div> <!-- / .container-fluid -->
</div> <!-- / .main -->
[% INCLUDE 'opac-bottom.inc' is_popup=1 %]
[% BLOCK jsinclude %]
<script>
//<![CDATA[
$(document).ready(function() {
[% IF WINDOW_CLOSE %]
opener.location.reload();
window.close();
[% END %]
});
//]]>
</script>
[% END %]