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

275 lines
12 KiB
Text

[% USE raw %]
[% USE Asset %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Administration &rsaquo; Classification sources
[% IF ( class_source_form ) %]
&rsaquo;
[% IF ( edit_class_source ) %]Modify classification source[% ELSE %]Add classification source[% END %]
[% END %]
[% IF ( sort_rule_form ) %]
&rsaquo;
[% IF ( edit_sort_rule ) %]Modify filing rule[% ELSE %]Add filing rule[% END %]
[% END %]
[% IF ( delete_class_source_form ) %]
&rsaquo; Confirm deletion of classification source [% class_source | html %]
[% ELSIF ( delete_sort_rule_form ) %]
&rsaquo; Confirm deletion of filing rule [% sort_rule | html %]
[% ELSIF ( delete_sort_rule_impossible ) %]
&rsaquo; Cannot delete filing rule [% sort_rule | html %]
[% END %]
</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="admin_classsources" class="admin">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'prefs-admin-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; <a href="/cgi-bin/koha/admin/classsources.pl">Classification sources</a>
[% IF ( class_source_form ) %]
&rsaquo; [% IF ( edit_class_source ) %]Modify classification source[% ELSE %]Add classification source[% END %]
[% END %]
[% IF ( sort_rule_form ) %]
&rsaquo; [% IF ( edit_sort_rule ) %]Modify filing rule[% ELSE %]Add filing rule[% END %]
[% END %]
[% IF ( delete_class_source_form ) %]
&rsaquo; Confirm deletion of classification source <span class="ex">'[% class_source | html %]'</span>
[% ELSIF ( delete_sort_rule_form ) %]
&rsaquo; Confirm deletion of filing rule <span class="ex">'[% sort_rule | html %]'</span>
[% ELSIF ( delete_sort_rule_impossible ) %]
&rsaquo; Cannot delete filing rule <span class="ex">'[% sort_rule | html %]'</span>
[% END %]
</div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
[% IF ( class_source_form ) %]
[% IF ( edit_class_source ) %]
<h2>Modify classification source</h2>
[% ELSE %]
<h2>Add classification source</h2>
[% END %]
<form action="[% script_name | html %]" name="Aform" class="validated" method="post">
<input type="hidden" name="op" value="[% confirm_op | html %]" />
<fieldset class="rows">
<ol>
<li>
[% IF ( edit_class_source ) %]
<span class="label">Classification source code: </span>
<input type="hidden" name="class_source" value="[% class_source | html %]" />
[% class_source | html %]
[% ELSE %]
<label class="required" for="class_source">Classification source code: </label>
<input class="required" required="required" type="text" id="class_source" name="class_source" size="10" maxlength="10" />
<span class="required">Required</span>
[% END %]
</li>
<li><label class="required" for="description">Description: </label>
<input class="required" required="required" type="text" id="description" name="description" size="50" maxlength="250" value="[% description | html %]" />
<span class="required">Required</span>
</li>
<li><label for="used">Source in use?</label>
[% IF ( used ) %]<input type="checkbox" id="used" name="used" value="used" checked="checked" />[% ELSE %]
<input type="checkbox" id="used" name="used" value="used" />[% END %]
</li>
<li><label class="required" for="sort_rule">Filing rule: </label>
<select class="required" required="required" id="sort_rule" name="sort_rule">
[% FOREACH rules_dropdow IN rules_dropdown %]
[% IF ( rules_dropdow.selected ) %]
<option value="[% rules_dropdow.rule | html %]" selected="selected">[% rules_dropdow.description | html %] ([% rules_dropdow.rule | html %])</option>
[% ELSE %]
<option value="[% rules_dropdow.rule | html %]">[% rules_dropdow.description | html %] ([% rules_dropdow.rule | html %])</option>
[% END %]
[% END %]
</select>
<span class="required">Required</span>
</li>
</ol>
</fieldset>
<fieldset class="action">
<input type="submit" value="Save" />
<a class="cancel" href="/cgi-bin/koha/admin/classsources.pl">Cancel</a>
</fieldset>
</form>
[% END %]
[% IF ( sort_rule_form ) %]
[% IF ( edit_sort_rule ) %]
<h2>Modify filing rule</h2>
[% ELSE %]
<h2>Add filing rule</h2>
[% END %]
<form action="[% script_name | html %]" name="Aform" class="validated" method="post">
<input type="hidden" name="op" value="[% confirm_op | html %]" />
<fieldset class="rows">
<ol>
<li>
[% IF ( edit_sort_rule ) %]
<span class="label">Filing rule code: </span>
<input type="hidden" name="sort_rule" value="[% sort_rule | html %]" />
[% sort_rule | html %]
[% ELSE %]
<label for="sort_rule" class="required">Filing rule code: </label>
<input class="required" required="required" type="text" id="sort_rule" name="sort_rule" size="10" maxlength="10" />
<span class="required">Required</span>
[% END %]
</li>
<li><label for="description" class="required">Description: </label>
<input class="required" required="required" type="text" id="description" name="description" size="50" maxlength="250" value="[% description | html %]" />
<span class="required">Required</span>
</li>
<li><label for="sort_routine" class="required">Filing routine: </label>
<select class="required" required="required" id="sort_routine" name="sort_routine">
[% FOREACH routines_dropdow IN routines_dropdown %]
[% IF ( routines_dropdow.selected ) %]
<option value="[% routines_dropdow.routine | html %]" selected="selected">[% routines_dropdow.routine | html %]</option>
[% ELSE %]
<option value="[% routines_dropdow.routine | html %]">[% routines_dropdow.routine | html %]</option>
[% END %]
[% END %]
</select>
<span class="required">Required</span>
</li>
</ol>
</fieldset>
<fieldset class="action">
<input type="submit" value="Save" />
<a class="cancel" href="/cgi-bin/koha/admin/classsources.pl">Cancel</a>
</fieldset>
</form>
[% END %]
[% IF ( delete_class_source_form ) %]
<div class="dialog alert">
<h3>Confirm deletion of classification source <span class="ex">'[% class_source | html %]'</span>?</h3>
<form action="[% script_name | html %]" name="Aform" method="post">
<input type="hidden" name="op" value="[% confirm_op | html %]" />
<input type="hidden" name="class_source" value="[% class_source | html %]" />
<button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete classification source</button>
</form>
<form action="[% script_name | html %]" 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_sort_rule_form ) %]
<div class="dialog alert">
<h3>Confirm deletion of filing rule <span class="ex">'[% sort_rule | html %]'</span>?</h3>
<form action="[% script_name | html %]" name="Aform" method="post">
<input type="hidden" name="op" value="[% confirm_op | html %]" />
<input type="hidden" name="sort_rule" value="[% sort_rule | html %]" />
<button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete filing rule</button>
</form>
<form action="[% script_name | html %]" 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_sort_rule_impossible ) %]
<div class="dialog alert"><h3>Cannot delete filing rule <span class="ex">'[% sort_rule | html %]'</span></h3>
<p>The filing rule [% sort_rule | html %] is used by at least one classification source. Please
remove it from all classification source definitions before trying again.
</p>
<form action="[% script_name | html %]" method="get">
<button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
</form>
</div>
[% END %]
[% IF ( display_lists ) %]
<div id="toolbar" class="btn-toolbar">
<a class="btn btn-default btn-sm" id="newsource" href="[% script_name | html %]?op=add_source"><i class="fa fa-plus"></i> New classification source</a>
<a class="btn btn-default btn-sm" id="newrule" href="[% script_name | html %]?op=add_sort_rule"><i class="fa fa-plus"></i> New filing rule</a>
</div>
<h2>Classification sources</h2>
[% IF ( added_source ) %]
<div class="dialog message">Added classification source [% added_source | html %]</div>
[% END %]
[% IF ( edited_source ) %]
<div class="dialog message">Modified classification source [% edited_source | html %]</div>
[% END %]
[% IF ( deleted_source ) %]
<div class="dialog message">Deleted classification source [% deleted_source | html %]</div>
[% END %]
[% IF ( failed_add_source ) %]
<div class="dialog message">Failed to add classification source [% failed_add_source | html %]. Perhaps the code already exists?</div>
[% END %]
<table>
<tr>
<th>Code</th>
<th>Description</th>
<th>In use</th>
<th>Filing rule</th>
<th>Actions</th>
</tr>
[% FOREACH class_source IN class_sources %]
<tr>
<td>[% class_source.code | html %]</td>
<td>[% class_source.description | html %]</td>
<td>[% IF ( class_source.used ) %]Yes[% ELSE %]No[% END %]</td>
<td>[% class_source.sortrule | html %]</td>
<td class="actions">
<a class="btn btn-default btn-xs" href="[% class_source.script_name | html %]?op=edit_source&amp;class_source=[% class_source.code | html %]"><i class="fa fa-pencil"></i> Edit</a>
<a class="btn btn-default btn-xs" href="[% class_source.script_name | html %]?op=delete_source&amp;class_source=[% class_source.code | html %]"><i class="fa fa-trash"></i> Delete</a>
</td>
</tr>
[% END %]
</table>
<h2>Classification filing rules</h2>
[% IF ( added_rule ) %]
<div class="dialog message">Added filing rule [% added_rule | html %]</div>
[% END %]
[% IF ( edited_rule ) %]
<div class="dialog message">Modified filing rule [% edited_rule | html %]</div>
[% END %]
[% IF ( deleted_rule ) %]
<div class="dialog message">Deleted filing rule [% deleted_rule | html %]</div>
[% END %]
[% IF ( failed_add_rule ) %]
<div class="dialog message">Failed to add filing rule [% failed_add_rule | html %]. Perhaps the code already exists?</div>
[% END %]
<table>
<tr>
<th>Code</th>
<th>Description</th>
<th>Sorting routine</th>
<th>Actions</th>
</tr>
[% FOREACH class_sort_rule IN class_sort_rules %]
<tr>
<td>[% class_sort_rule.rule | html %]</td>
<td>[% class_sort_rule.description | html %]</td>
<td>[% class_sort_rule.sort_routine | html %]</td>
<td class="actions">
<a class="btn btn-default btn-xs" href="[% class_sort_rule.script_name | html %]?op=edit_sort_rule&amp;sort_rule=[% class_sort_rule.rule | html %]"><i class="fa fa-pencil"></i> Edit</a>
<a class="btn btn-default btn-xs" href="[% class_sort_rule.script_name | html %]?op=delete_sort_rule&amp;sort_rule=[% class_sort_rule.rule | html %]"><i class="fa fa-trash"></i> Delete</a>
</td>
</tr>
[% END %]
</table>
[% END %]
</div>
</div>
<div class="yui-b">
[% INCLUDE 'admin-menu.inc' %]
</div>
</div>
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/admin-menu.js") | $raw %]
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]