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

149 lines
6.9 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE Branches %]
[% USE Koha %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Acquisitions &rsaquo;
[% IF ( add_form ) %]
[% IF ( basketno ) %]Edit basket '[% basketname | html %]'
[% ELSE %]Add a basket to [% booksellername | html %]
[% END %]
[% END %]
</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="acq_basketheader" class="acq">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'acquisitions-search.inc' %]
<div id="breadcrumbs">
<a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
<a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo;
<a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% booksellername | html %]</a> &rsaquo;
[% IF ( add_form ) %]
[% IF ( basketno ) %]Edit basket '[% basketname | html %]'
[% ELSE %]Add a basket to [% booksellername | html %]
[% END %]
[% END %]
</div>
<div class="main container-fluid">
<div class="row">
<div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
[% IF ( add_form ) %]
[% IF ( basketno ) %]
<h1>Edit basket [% basketname | html %]</h1>
[% ELSE %]<h1>Add a basket to [% booksellername | html %]</h1>
[% END %]
<form name="Aform" action="[% script_name | html %]" method="post" class="validated">
<input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
<fieldset class="rows">
<ol>
[% IF ( basketno ) %]
<li>
<input type="hidden" name="basketno" value="[% basketno | html %]" />
<input type="hidden" name="is_an_edit" value="1" />
</li>
[% END %]
<li>
<label for="basketname" class="required">Basket name: </label>
<input type="text" name="basketname" id="basketname" size="40" maxlength="80" value="[% basketname | html %]" required="required" class="required" />
<span class="required">Required</span>
</li>
<li>
<label for="billingplace">Billing place: </label>
<select name="billingplace" id="billingplace">
<option value="">--</option>
[% PROCESS options_for_libraries libraries => Branches.all( selected => billingplace ) %]
</select>
</li>
<li>
<label for="deliveryplace">Delivery place: </label>
<select name="deliveryplace" id="deliveryplace">
<option value="">--</option>
[% PROCESS options_for_libraries libraries => Branches.all( selected => deliveryplace ) %]
</select>
</li>
<li>
<label for="basketbooksellerid">Vendor: </label>
<select name="basketbooksellerid" id="basketbooksellerid">
[% FOREACH b IN booksellers %]
[% IF booksellerid == b.id %]
<option value="[% b.id | html %]" selected="selected">[% b.name | html %]</option>
[% ELSE %]
<option value="[% b.id | html %]">[% b.name | html %]</option>
[% END %]
[% END %]
</select>
</li>
<li>
<label for="basketnote">Internal note: </label>
<textarea name="basketnote" id="basketnote" rows="5" cols="40">[% basketnote |html %]</textarea>
</li>
<li>
<label for="basketbooksellernote">Vendor note: </label>
<textarea name="basketbooksellernote" id="basketbooksellernote" rows="5" cols="40">[% basketbooksellernote |html %]</textarea>
</li>
[% IF ( contractloop ) %]
<li><label for="basketcontractnumber">Contract: </label>
<select id="basketcontractnumber" name="basketcontractnumber">
<option value=""></option>
[% FOREACH contractloo IN contractloop %]
[% IF ( contractloo.selected ) %]
<option value="[% contractloo.contractnumber | html %]" selected="selected">[% contractloo.contractname | html %]</option>
[% ELSE %]
<option value="[% contractloo.contractnumber | html %]">[% contractloo.contractname | html %]</option>
[% END %]
[% END %]
</select>
</li>
[% END %]
<li>
<label for="is_standing">Orders are standing:</label>
[% IF is_standing %]
<input type="checkbox" id="is_standing" name="is_standing" checked="checked" />
[% ELSE %]
<input type="checkbox" id="is_standing" name="is_standing"/>
[% END %]
<div class="hint">Standing orders do not close when received.</div>
</li>
[% UNLESS basketno %]
<li>
<label for="create_items">Create items when:</label>
<select name="create_items" id="create_items">
[% SWITCH Koha.Preference('AcqCreateItem') %]
[% CASE 'receiving' %]<option value="">use default (receiving an order)</option>
[% CASE 'cataloguing' %]<option value="">use default (cataloging the record)</option>
[% CASE %]<option value="">use default (placing an order)</option>
[% END %]
<option value="ordering">placing an order</option>
<option value="receiving">receiving an order</option>
<option value="cataloguing">cataloging the record</option>
</select>
</li>
[% END %]
</ol>
</fieldset>
<fieldset class="action">
<input type="hidden" name="op" value="add_validate" />
<input type="submit" value="Save" />
[% IF ( basketno ) %]
<a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno | html %]">Cancel</a>
[% ELSE %]
<a class="cancel" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">Cancel</a>
[% END %]
</fieldset>
</form>
[% END %]
</div>
</div>
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/acquisitions-menu.js") | $raw %]
[% Asset.js("js/acq.js") | $raw %]
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]