Koha/koha-tmpl/intranet-tmpl/prog/en/includes/auth-finder-search.inc
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

163 lines
9.1 KiB
HTML

[% PROCESS 'form-blocks.inc' %]
<div id="toolbar" class="btn-toolbar">
<div class="btn-group"><a href="#" id="clear" class="btn btn-default btn-sm"><i class="fa fa-trash"></i> Clear field</a></div>
<div class="btn-group"><a href="#" id="createnew" class="btn btn-default btn-sm"><i class="fa fa-plus"></i> Create new authority</a></div>
</div>
<form name="f" method="get" action="auth_finder.pl">
<input type="hidden" name="source" value="[% source | html %]" />
<input type="hidden" name="op" value="do_search" />
<input type="hidden" name="type" value="intranet" />
<input type="hidden" name="index" value="[% index | html %]" />
<fieldset class="rows"><legend>Search options</legend>
<ol><li>
<span class="label">Authority type: </span>
[% authtypecode | html %]
<input type="hidden" name="authtypecode" value="[% authtypecode | html %]" />
</li>
<li>
<label for="mainmainentry">Search main heading ($a only): </label>
<input type="hidden" name="marclist" value="mainmainentry" />
<input type="hidden" name="and_or" value="and" />
<input type="hidden" name="excluding" value="" />
<select name="operator" id="mainmainentry">
[% IF ( operator_mainstr == 'contains' ) %]
<option value="contains" selected="selected">contains</option>
[% ELSE %]
<option value="contains">contains</option>
[% END %]
[% IF ( operator_mainstr == 'start' ) %]
<option value="start" selected="selected">starts with</option>
[% ELSE %]
<option value="start">starts with</option>
[% END %]
[% IF ( operator_mainstr == 'is' ) %]
<option value="is" selected="selected">is exactly</option>
[% ELSE %]
<option value="is">is exactly</option>
[% END %]
</select>
<input id="value_mainstr" style="width:400px;" type="text" name="value_mainstr" value="[% value_mainstr | html %]" />
<div id="yvaluecontainermainmainentry"></div>
</li>
<li>
<label for="mainentry">Search main heading: </label>
<input type="hidden" name="marclist" value="mainentry" />
<input type="hidden" name="and_or" value="and" />
<input type="hidden" name="excluding" value="" />
<select name="operator" id="mainentry">
[% IF ( operator_main == 'contains' ) %]
<option value="contains" selected="selected">contains</option>
[% ELSE %]
<option value="contains">contains</option>
[% END %]
[% IF ( operator_main == 'start' ) %]
<option value="start" selected="selected">starts with</option>
[% ELSE %]
<option value="start">starts with</option>
[% END %]
[% IF ( operator_main == 'is' ) %]
<option value="is" selected="selected">is exactly</option>
[% ELSE %]
<option value="is">is exactly</option>
[% END %]
</select>
<input id="value_main" style="width:400px;" type="text" name="value_main" value="[% value_main | html %]" />
<div id="yvaluecontainermainentry"></div>
</li>
<li>
<label for="marclistheading">Search all headings: </label>
<input type="hidden" name="marclist" value="match" />
<input type="hidden" name="and_or" value="and" />
<input type="hidden" name="excluding" value="" />
<select name="operator" id="marclistheading">
[% IF ( operator_match == 'contains' ) %]
<option value="contains" selected="selected">contains</option>
[% ELSE %]
<option value="contains">contains</option>
[% END %]
[% IF ( operator_match == 'start' ) %]
<option value="start" selected="selected">starts with</option>
[% ELSE %]
<option value="start">starts with</option>
[% END %]
[% IF ( operator_match == 'is' ) %]
<option value="is" selected="selected">is exactly</option>
[% ELSE %]
<option value="is">is exactly</option>
[% END %]
</select>
<input type="text" name="value_match" value="[% value_match | html %]" />
</li>
<li>
<label for="marclistanywhere">Search entire record: </label>
<input type="hidden" name="marclist" value="all" />
<input type="hidden" name="and_or" value="and" />
<input type="hidden" name="excluding" value="" />
<select name="operator" id="marclistanywhere">
[% IF ( operator_any == 'contains' ) %]
<option value="contains" selected="selected">contains</option>
[% ELSE %]
<option value="contains">contains</option>
[% END %]
[% IF ( operator_any == 'start' ) %]
<option value="start" selected="selected">starts with</option>
[% ELSE %]
<option value="start">starts with</option>
[% END %]
[% IF ( operator_any == 'is' ) %]
<option value="is" selected="selected">is exactly</option>
[% ELSE %]
<option value="is">is exactly</option>
[% END %]
</select>
<input id="value_any" style="width:400px;" type="text" name="value_any" value="[% value_any | html %]" />
<div id="yvaluecontainermarclist"></div>
</li>
<li>
<label for="orderby">Sort by: </label>
<select name="orderby" id="orderby">
[% IF ( orderby == 'HeadingAsc' ) %]
<option value="HeadingAsc" selected="selected">Heading A-Z</option>
[% ELSE %]
<option value="HeadingAsc">Heading A-Z</option>
[% END %]
[% IF ( orderby == 'HeadingDsc' ) %]
<option value="HeadingDsc" selected="selected">Heading Z-A</option>
[% ELSE %]
<option value="HeadingDsc">Heading Z-A</option>
[% END %]
[% IF ( orderby == '' && op ) %]
<option value="" selected="selected">None</option>
[% ELSE %]
<option value="">None</option>
[% END %]
</select>
</li></ol></fieldset>
[% IF source == 'auth' %]
<fieldset class="rows"><legend>Relationship information</legend>
<ol>
<li>
<label for="relationship">Special relationship: </label>
<select name="relationship" id="relationship">
[% selected=relationship | html %]
[% PROCESS selectoptionopen value='' %]None specified</option>
[% PROCESS selectoptionopen value='a' %]a - Earlier heading</option>
[% PROCESS selectoptionopen value='b' %]b - Later heading</option>
[% PROCESS selectoptionopen value='d' %]d - Acronym</option>
[% PROCESS selectoptionopen value='f' %]f - Musical composition</option>
[% PROCESS selectoptionopen value='g' %]g - Broader term</option>
[% PROCESS selectoptionopen value='h' %]h - Narrower term</option>
[% PROCESS selectoptionopen value='i' %]i - Reference instruction phrase in subfield $i</option>
[% PROCESS selectoptionopen value='n' %]n - Not applicable</option>
[% PROCESS selectoptionopen value='r' %]r - Relationship designation in $i or $4</option>
[% PROCESS selectoptionopen value='t' %]t - Immediate parent body</option>
</select>
</li>
</ol>
</fieldset>
[% END %]
<fieldset class="action"> <input type="submit" value="Search" class="submit" id="search" /> <a id="cancel" class="cancel close" href="#">Cancel</a>
</fieldset>
</form>