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

124 lines
4.7 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE Koha %]
[% USE AuthorisedValues %]
[% USE Branches %]
[% USE KohaDates %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Sent notices for [% INCLUDE 'patron-title.inc' no_html = 1 %]</title>
[% INCLUDE 'doc-head-close.inc' %]
[% Asset.css("css/datatables.css") | $raw %]
<style type="text/css">
.notice { display: none; }
.notice-title { font-weight: bold; display: block; }
</style>
</head>
<body id="pat_notices" class="pat">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'patron-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> &rsaquo; Sent notices for [% INCLUDE 'patron-title.inc' %]</div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
[% INCLUDE 'members-toolbar.inc' %]
<h1>Sent notices for [% INCLUDE 'patron-title.inc' %]</h1>
[% IF ( QUEUED_MESSAGES ) %]
<table id="noticestable">
<thead>
<tr>
<th>Notice</th>
<th>Type</th>
<th>Status</th>
<th>Time</th>
</tr>
</thead>
<tbody>
[% FOREACH QUEUED_MESSAGE IN QUEUED_MESSAGES %]
<tr>
<td>
<a class="notice-title" data-noticeid="[% QUEUED_MESSAGE.message_id | html %]" href="#">[% QUEUED_MESSAGE.subject | html %]</a>
<div id="notice[% QUEUED_MESSAGE.message_id | html %]" class="notice">
<iframe srcdoc="[% QUEUED_MESSAGE.content FILTER html_line_break | html %]"></iframe>
</div>
</td>
<td>
[% IF ( QUEUED_MESSAGE.message_transport_type == 'email' ) %]email
[% ELSIF ( QUEUED_MESSAGE.message_transport_type == 'print' ) %]print
[% ELSIF ( QUEUED_MESSAGE.message_transport_type == 'feed' ) %]feed
[% ELSIF ( QUEUED_MESSAGE.message_transport_type == 'sms' ) %]sms
[% ELSE %][% QUEUED_MESSAGE.message_transport_type | html %][% END %]
</td>
<td>
[% IF ( QUEUED_MESSAGE.status == 'sent' ) %]sent
[% ELSIF ( QUEUED_MESSAGE.status == 'pending' ) %]pending
[% ELSIF ( QUEUED_MESSAGE.status == 'failed' ) %]failed
[% ELSIF ( QUEUED_MESSAGE.status == 'deleted' ) %]deleted
[% ELSE %][% QUEUED_MESSAGE.status | html %][% END %]
[% IF ( QUEUED_MESSAGE.status != 'pending' ) %]
<div id="resend_notice[% QUEUED_MESSAGE.message_id | html %]" class="notice">
<form action="/cgi-bin/koha/members/notices.pl?borrowernumber=[% borrowernumber | html %]" method="POST">
<input type="hidden" name="op" value="resend_notice" />
<input type="hidden" name="borrowernumber" value="[% borrowernumber | html %]" />
<input type="hidden" name="message_id" value="[% QUEUED_MESSAGE.message_id | html %]" />
<fieldset class="action">
<button class="btn btn-default btn-xs" type="submit">Resend</button>
</fieldset>
</form>
</div>
[% END %]
</td>
<td><span title="[% QUEUED_MESSAGE.time_queued | html %]">[% QUEUED_MESSAGE.time_queued | $KohaDates with_hours => 1 | html %]</span></td>
</tr>
[% END %]
</tbody>
</table>
[% ELSE %]
<div class="dialog message">There is no record of any messages that have been sent to this patron.</div>
[% END %]
</div>
</div>
<div class="yui-b">
[% INCLUDE 'circ-menu.inc' %]
</div>
</div>
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'datatables.inc' %]
<script type="text/javascript">
$(document).ready(function() {
$("#noticestable").dataTable($.extend(true, {}, dataTablesDefaults, {
"aaSorting": [[ 3, "desc" ]],
"aoColumns": [ null,null,null,{ "sType": "title-string" } ],
"sPaginationType": "four_button"
}));
$("#noticestable").on("click", ".notice-title", function(e){
e.preventDefault();
var rowid = $(this).data("noticeid");
$("#notice"+rowid).toggle();
$("#resend_notice"+rowid).toggle();
var iframe = $("#notice"+rowid).children('iframe');
// Adding some padding to the height and width to remove scrollbars
var height = iframe.get(0).contentWindow.document.body.scrollHeight + 25;
var width = iframe.get(0).contentWindow.document.body.scrollWidth + 25;
iframe.css({
'width': width + 'px',
'height': height + 'px'
});
});
});
</script>
[% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") | $raw %]
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]