Koha/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-MARCdetail.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

215 lines
11 KiB
Text

[% USE raw %]
[% USE Koha %]
[% INCLUDE 'doc-head-open.inc' %]
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo; MARC details for record no. [% biblio.biblionumber | html %]</title>
[% INCLUDE 'doc-head-close.inc' %]
[% BLOCK cssinclude %][% END %]
</head>
[% INCLUDE 'bodytag.inc' bodyid='opac-marcdetail' bodyclass='scrollto' %]
[% INCLUDE 'masthead.inc' %]
<div class="main">
<ul class="breadcrumb">
<li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
<li><a href="#">MARC view: [% bibliotitle | html %]</a></li>
</ul>
<div class="container-fluid">
<div class="row-fluid">
<div class="span9">
<div id="opac-detail" class="maincontent">
<div id="usermarcdetail">
<div id="catalogue_detail_biblio">
<div id="views">
<span class="view"><a id="Normalview" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | html %]">Normal view</a></span>
<span class="view current-view"><span id="MARCview">MARC view</span></span>
[% IF ( ISBD ) %]<span class="view"><a id="ISBDview" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=[% biblio.biblionumber | html %]">ISBD view</a></span>[% END %]
</div>
<h1 class="title">[% bibliotitle | html %] (Record no. [% biblio.biblionumber | html %])</h1>
[% IF ( OPACXSLTDetailsDisplay ) %]
<div id="switchview_div">[ <a id="switchview" href="/cgi-bin/koha/opac-showmarc.pl?id=[% biblio.biblionumber | html %]&amp;viewas=html">view plain</a> ]</div>
<div id="plainmarc"></div>
[% END %]
<div id="labeledmarc">
<table id="marc" class="table table-bordered table-striped">
[% FOREACH tab0X IN tab0XX %]
<tr><th colspan="2">[% tab0X.tag | html %]</th></tr>
[% FOREACH subfiel IN tab0X.subfield %]
<tr>
<td>[% subfiel.marc_lib | $raw %]</td>
<td>[% subfiel.marc_value | html %]</td>
</tr>
[% END %]
[% END %]
[% FOREACH tab1X IN tab1XX %]
<tr><th colspan="2">[% tab1X.tag | html %]</th></tr>
[% FOREACH subfiel IN tab1X.subfield %]
<tr>
<td >[% subfiel.marc_lib | $raw %]</td>
<td >[% subfiel.marc_value | html %]</td>
</tr>
[% END %]
[% END %]
[% FOREACH tab2X IN tab2XX %]
<tr><th colspan="2">[% tab2X.tag | html %]</th></tr>
[% FOREACH subfiel IN tab2X.subfield %]
<tr>
<td>[% subfiel.marc_lib | $raw %]</td>
<td>[% subfiel.marc_value | html %]</td>
</tr>
[% END %]
[% END %]
[% FOREACH tab3X IN tab3XX %]
<tr><th colspan="2">[% tab3X.tag | html %]</th></tr>
[% FOREACH subfiel IN tab3X.subfield %]
<tr>
<td>[% subfiel.marc_lib | $raw %]</td>
<td>[% subfiel.marc_value | html %]</td>
</tr>
[% END %]
[% END %]
[% FOREACH tab4X IN tab4XX %]
<tr><th colspan="2" >[% tab4X.tag | html %]</th></tr>
[% FOREACH subfiel IN tab4X.subfield %]
<tr>
<td>[% subfiel.marc_lib | $raw %]</td>
<td>[% subfiel.marc_value | html %]</td>
</tr>
[% END %]
[% END %]
[% FOREACH tab5X IN tab5XX %]
<tr><th colspan="2">[% tab5X.tag | html %]</th></tr>
[% FOREACH subfiel IN tab5X.subfield %]
<tr>
<td>[% subfiel.marc_lib | $raw %]</td>
<td>[% subfiel.marc_value | html %]</td>
</tr>
[% END %]
[% END %]
[% FOREACH tab6X IN tab6XX %]
<tr><th colspan="2">[% tab6X.tag | html %]</th></tr>
[% FOREACH subfiel IN tab6X.subfield %]
<tr>
<td>[% subfiel.marc_lib | $raw %]</td>
<td>[% subfiel.marc_value | html %]</td>
</tr>
[% END %]
[% END %]
[% FOREACH tab7X IN tab7XX %]
<tr><th colspan="2">[% tab7X.tag | html %]</th></tr>
[% FOREACH subfiel IN tab7X.subfield %]
<tr>
<td>[% subfiel.marc_lib | $raw %]</td>
<td>[% subfiel.marc_value | html %]</td>
</tr>
[% END %]
[% END %]
[% FOREACH tab8X IN tab8XX %]
<tr><th colspan="2">[% tab8X.tag | html %]</th></tr>
[% FOREACH subfiel IN tab8X.subfield %]
<tr>
<td>[% subfiel.marc_lib | $raw %]</td>
<td>[% subfiel.marc_value | html %]</td>
</tr>
[% END %]
[% END %]
[% FOREACH tab9X IN tab9XX %]
<tr><th colspan="2">[% tab9X.tag | html %]</th></tr>
[% FOREACH subfiel IN tab9X.subfield %]
<tr>
<td>[% subfiel.marc_lib | $raw %]</td>
<td>[% subfiel.marc_value | html %]</td>
</tr>
[% END %]
[% END %]
</table>
</div>
[% IF ( item_header_loop ) %]
<table id="items" class="table table-bordered table-condensed table-striped">
<caption>Holdings</caption>
<thead>
<tr>
[% FOREACH header IN item_header_loop %]
<th>[% header | html %]</th>
[% END %]
</tr>
</thead>
<tbody>
[% FOREACH item IN item_loop %]
<tr>
[% FOREACH sf_code IN item_subfield_codes %]
<td>[% item.$sf_code | html %]</td>
[% END %]
</tr>
[% END %]
</tbody>
</table>
[% ELSE %]
<p>No items available.</p>
[% END %]
</div> <!-- / #catalogue_detail_biblio -->
</div> <!-- / #usermarcdetail -->
</div> <!-- / #opac-detail -->
</div> <!-- / .span9 -->
<div class="span3">
[% INCLUDE 'opac-detail-sidebar.inc' %]
</div>
</div> <!-- / .row-fluid -->
</div> <!-- / .container-fluid -->
</div> <!-- / .main -->
[% INCLUDE 'opac-bottom.inc' %]
[% BLOCK jsinclude %]
<script>
//<![CDATA[
[% IF ( OPACXSLTDetailsDisplay ) %]
$(document).ready(function(){
$.ajaxSetup({
error:function(x,e){
switch (x.status) {
case 200: break;
default:
$('#switchview').parent().html("<div class=\"dialog alert\">"+_("Sorry, plain view is temporarily unavailable")+".</div>");
$("#plainmarc").hide();
$("#labeledmarc").show();
break;
}
}
});
var loaded = 0;
var toggle = 0;
$("#switchview").on("click",function(e){
e.preventDefault();
if( toggle == 0){
$(this).text(_("view labeled"));
$("#labeledmarc").hide();
if(!loaded){
$("#plainmarc").show().html("<div style=\"margin:1em;padding:1em;border:1px solid #EEE;font-size:150%;\"><img src=\"[% interface | html %]/[% theme | html %]/images/loading.gif\" /> "+_("Loading")+"...</div>").load("/cgi-bin/koha/opac-showmarc.pl","id=[% biblio.biblionumber | html %]&viewas=html");
loaded = 1;
} else {
$("#plainmarc").show();
}
toggle = 1;
} else {
$(this).text(_("view plain"));
$("#labeledmarc").show();
$("#plainmarc").hide();
toggle = 0;
}
});
});
[% END %]
//]]>
</script>
[% END %]