Koha/koha-tmpl/intranet-tmpl/prog/en/modules/admin/printers.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

171 lines
6.6 KiB
Text

[% USE raw %]
[% USE Asset %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Administration &rsaquo;
[% IF ( add_form ) %][% IF ( searchfield ) %] Printers &rsaquo; Modify printer '[% searchfield | html %]'[% ELSE %] Printers &rsaquo; New printer[% END %][% END %]
[% IF ( add_validate ) %] Printers &rsaquo; Printer added[% END %]
[% IF ( delete_confirm ) %] Printers &rsaquo; Confirm deletion of printer '[% searchfield | html %]'[% END %]
[% IF ( delete_confirmed ) %] Printers &rsaquo; Printer deleted[% END %]
[% IF ( else ) %]Printers[% END %]</title>
[% INCLUDE 'doc-head-close.inc' %]
[% IF ( loop ) %]
[% Asset.css("css/datatables.css") | $raw %]
[% INCLUDE 'datatables.inc' %]
<script type="text/javascript">
//<![CDATA[
$(document).ready(function() {
$("#printerst").dataTable($.extend(true, {}, dataTablesDefaults, {
"aoColumnDefs": [
{ "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
],
"aaSorting": [[ 0, "asc" ]],
"sPaginationType": "four_button"
}));
});
//]]>
</script>
[% END %]
</head>
<body id="admin_printers" class="admin">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; [% IF ( add_form ) %][% IF ( searchfield ) %] <a href="/cgi-bin/koha/admin/printers.pl">Printers</a> &rsaquo; Modify printer '[% searchfield | html %]'[% ELSE %] <a href="/cgi-bin/koha/admin/printers.pl">Printers</a> &rsaquo; New printer[% END %][% END %]
[% IF ( add_validate ) %] <a href="/cgi-bin/koha/admin/printers.pl">Printers</a> &rsaquo; Printer added[% END %]
[% IF ( delete_confirm ) %] <a href="/cgi-bin/koha/admin/printers.pl">Printers</a> &rsaquo; Confirm deletion of printer '[% searchfield | html %]'[% END %]
[% IF ( delete_confirmed ) %] <a href="/cgi-bin/koha/admin/printers.pl">Printers</a> &rsaquo; Printer deleted[% END %]
[% IF ( else ) %]Printers[% END %]</div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
[% IF ( add_form ) %]
[% IF ( searchfield ) %]
<h1>Modify printer</h1>
[% ELSE %]
<h1>New printer</h1>
[% END %]
<form action="[% script_name | html %]" name="Aform" method="post" class="validated">
<input type="hidden" name="op" value="add_validate" />
[% IF ( searchfield ) %]
<input type="hidden" name="add" value="0" />
[% ELSE %]
<input type="hidden" name="add" value="1" />
[% END %]
<fieldset class="rows">
<ol> [% IF ( searchfield ) %]
<li>
<span class="label">Printer name: </span>
<input type="hidden" name="printername" id="" value="[% searchfield | html %]" />[% searchfield | html %]
</li>
[% ELSE %]
<li>
<label for="printername" class="required">Printer name: </label>
<input type="text" name="printername" id="printername" size="40" maxlength="40" class="required" required="required" />
<span class="required">Required</span>
</li>
[% END %]
<li>
<label for="printqueue" class="required">Queue: </label>
<input type="text" name="printqueue" id="printqueue" size="20" maxlength="20" value="[% printqueue | html %]" class="required" required="required" />
<span class="required">Required</span>
</li>
<li>
<label for="printtype">Type: </label>
<input type="text" name="printtype" id="printtype" size="20" maxlength="20" value="[% printtype | html %]" />
</li></ol>
</fieldset>
<fieldset class="action"><input type="submit" value="Submit" /> <a class="cancel" href="/cgi-bin/koha/admin/printers.pl">Cancel</a></fieldset>
</form>
[% END %]
[% IF ( add_validate ) %]
<h3>Printer added</h3>
<form action="[% script_name | html %]" method="post">
<fieldset class="action"> <input type="submit" value="OK" /></fieldset>
</form>
[% END %]
[% IF ( delete_confirm ) %]
<div class="dialog alert">
<h3>Confirm deletion of printer <em>[% searchfield | html %]</em></h3>
<table>
<tr>
<th scope="row">Printer: </th><td>[% searchfield | html %]</td>
</tr>
<tr>
<th scope="row">Queue: </th><td>[% printqueue | html %]</td>
</tr>
<tr>
<th scope="row">Type: </th><td>[% printtype | html %]</td>
</tr>
</table>
<form action="[% script_name | html %]" method="post">
<input type="hidden" name="op" value="delete_confirmed" />
<input type="hidden" name="searchfield" value="[% searchfield | html %]" />
<button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
</form>
<form action="/cgi-bin/koha/admin/printers.pl" method="get">
<button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
</form>
</div>
[% END %]
[% IF ( delete_confirmed ) %]
<div class="dialog message">
<h3>Printer deleted</h3>
<form action="[% script_name | html %]" method="post">
<button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
</form>
</div>
[% END %]
[% IF ( else ) %]
<div id="toolbar" class="btn-toolbar">
<a class="btn btn-default btn-sm" id="newprinter" href="/cgi-bin/koha/admin/printers.pl?op=add_form"><i class="fa fa-plus"></i> New printer</a>
</div>
<h2>Printers</h2>
[% IF ( searchfield ) %]
You searched for [% searchfield | html %]</span>
[% END %]
[% IF ( loop ) %]
<table id="printerst">
<thead>
<tr>
<th>Name</th>
<th>Queue</th>
<th>Type</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
[% FOREACH loo IN loop %]
<tr>
<td>[% loo.printername | html %]</td>
<td>[% loo.printqueue | html %]</td>
<td>[% loo.printtype | html %]</td>
<td class="actions"><a class="btn btn-default btn-xs" href="[% loo.script_name | html %]?op=add_form&amp;searchfield=[% loo.printername |uri %]"><i class="fa fa-pencil"></i> Edit</a> <a class="btn btn-default btn-xs" href="[% loo.script_name | html %]?op=delete_confirm&amp;searchfield=[% loo.printername |uri %]"><i class="fa fa-trash"></i> Delete</a></td>
</tr>
[% END %]
</tbody>
</table>[% ELSE %]<div class="dialog message">No printers defined.</div>[% END %]
[% END %]
</div>
</div>
<div class="yui-b">
[% INCLUDE 'admin-menu.inc' %]
</div>
</div>
[% INCLUDE 'intranet-bottom.inc' %]