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

109 lines
3.9 KiB
Text

[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]<title>Koha &rsaquo; Labels</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="labels_search" class="tools labels">
<div class="main container-fluid">
<h1>Search for items
[% IF ( batch_id ) %]
to add to Batch [% batch_id | html %]
[% END %]
</h1>
<form name="f" method="post" action="/cgi-bin/koha/labels/label-item-search.pl">
<input type="hidden" name="op" value="do_search" />
<input type="hidden" name="batch_id" value="[% batch_id | html %]" />
<input type="hidden" name="type" value="[% type | html %]" />
<fieldset class="rows">
<ol><li>
<select name="idx" > <!-- FIXME: script does keyword search regardless -->
[% IF idx == 'kw' %]<option value="kw" selected="selected">Keyword</option>
[% ELSE %]<option value="kw">Keyword</option>[% END %]
[% IF idx == 'au' %]<option value="au" selected="selected">Author</option>
[% ELSE %]<option value="au">Author</option>[% END %]
[% IF idx == 'yr' %]<option value="yr" selected="selected">Publication date</option>
[% ELSE %]<option value="yr">Publication date</option>[% END %]
[% IF idx == 'sn' %]<option value="sn" selected="selected">Standard number</option>
[% ELSE %]<option value="sn">Standard number</option>[% END %]
[% IF idx == 'nb' %]<option value="nb" selected="selected">ISBN</option>
[% ELSE %]<option value="nb">ISBN</option>[% END %]
[% IF idx == 'ns' %]<option value="ns" selected="selected">ISSN</option>
[% ELSE %]<option value="ns">ISSN</option>[% END %]
[% IF idx == 'lcn,phr' %]<option value="lcn,phr" selected="selected">Call number</option>
[% ELSE %]<option value="lcn,phr">Call number</option>[% END %]
[% IF idx == 'su' %]<option value="su" selected="selected">Subject</option>
[% ELSE %]<option value="su">Subject</option>[% END %]
[% IF idx == 'ti' %]
<option value="ti" selected="selected">Title</option>
[% ELSE %]
<option value="ti">Title</option>[% END %]
[% IF idx == 'ti,phr' %]<option value="ti,phr" selected="selected">Title phrase</option>
[% ELSE %]<option value="ti,phr">Title phrase</option>[% END %]
[% IF idx == 'se' %]<option value="se" selected="selected">Series title</option>
[% ELSE %]<option value="se">Series title</option>[% END %]
[% IF idx == 'bc' or not idx %]<option value="bc" selected="selected">Barcode</option>
[% ELSE %]<option value="bc">Barcode</option>[% END %]
[% IF idx == 'acqdate' %]<option value="acqdate" selected="selected">Acquisition date</option>
[% ELSE %]<option value="acqdate">Acquisition date</option>[% END %]
</select>
<input type="text" size="30" id="ccl_textbox" name="ccl_textbox" class="focus" title="Enter search terms" value=""/>
</li>
</ol>
</fieldset>
[% IF ( sort_by_loop ) %]
<fieldset><legend>Sort by: </legend>
<p><select id="sort_by" name="sort_by">
<option value="">Field-weighted, relevance ranked</option>
[% FOREACH sort_by_loo IN sort_by_loop %]
[% IF ( sort_by_loo.selected ) %]<option value="[% sort_by_loo.value | html %]" selected="selected">[% sort_by_loo.label | html %]</option>[% ELSE %]<option value="[% sort_by_loo.value | html %]">[% sort_by_loo.label | html %]</option>[% END %]
[% END %]
</select>
</p>
</fieldset>[% END %]
<fieldset class="rows">
<ol>
<li>
<label for="from">Added on or after date: </label>
<input type="text" size="10" id="from" name="datefrom" class="datepickerfrom" value="" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
<li>
<label for="to">Added on or before date: </label>
<input type="text" size="10" id="to" name="dateto" class="datepickerto" value="" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li></ol>
</fieldset>
<fieldset class="action"><input type="submit" value="Search" class="submit" /> <a class="cancel close" href="#">Cancel</a></fieldset>
</form>
</div>
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'calendar.inc' %]
[% END %]
[% INCLUDE 'intranet-bottom.inc' popup_window=1 %]