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

221 lines
12 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE Koha %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha staff client</title>
[% Asset.css("css/mainpage.css") | $raw %]
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="main_intranet-main" class="intranet-main">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'home-search.inc' %]
<div id="breadcrumbs">Home</div>
<div id="container-main" class="container-fluid">
<div class="row">
<div class="col-sm-3">
[% IF ( koha_news_count ) %]
<div id="area-news">
<h3><span class="news_title">News</span></h3>
[% SET newsdisp = Koha.Preference('NewsAuthorDisplay') %]
[% FOREACH koha_new IN koha_news %]
<div class="newsitem" id="news[% koha_new.idnew | html %]"><h4>[% koha_new.title | html %]</h4>
<div class="newsbody">[% koha_new.content | $raw %]</div>
<p class="newsfooter"> Posted on [% koha_new.newdate | html %][% IF( ( newsdisp == 'staff' || newsdisp == 'both' ) && koha_new.borrowernumber ) %] by <span class="newsauthor_title">[% koha_new.author_title | html %] </span>[% koha_new.author_firstname | html %] [% koha_new.author_surname | html %]<br />[% END %]
[% IF ( CAN_user_tools ) %]
<a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&amp;id=[% koha_new.idnew | html %]">Edit</a>
| <a class="news_delete" href="/cgi-bin/koha/tools/koha-news.pl?op=del&amp;ids=[% koha_new.idnew | html %]">Delete</a>
| <a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form">New</a>
[% END %]
</p>
</div>
[% END %]
</div><!-- /koha-news -->
[% END %]
</div> <!-- /.col-sm-2 -->
<div class="col-sm-9">
<div class="row">
<div class="col-xs-6">
<ul class="biglinks-list">
[% IF ( CAN_user_circulate_circulate_remaining_permissions ) %]
<li>
<a class="icon_general icon_circulation" href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a>
</li>
[% END %]
[% IF CAN_user_borrowers_edit_borrowers %]
<li>
<a class="icon_general icon_patrons" href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
</li>
[% END %]
[% IF ( CAN_user_catalogue ) %]
<li>
<a class="icon_general icon_search" href="/cgi-bin/koha/catalogue/search.pl">Advanced search</a>
</li>
[% END %]
<li>
<a class="icon_general icon_lists" href="/cgi-bin/koha/virtualshelves/shelves.pl">Lists</a>
</li>
[% IF ( UseCourseReserves ) %]
<li>
<a class="icon_general icon_course_reserves" href="/cgi-bin/koha/course_reserves/course-reserves.pl">Course reserves</a>
</li>
[% END %]
<li>
<a class="icon_general icon_authorities" href="/cgi-bin/koha/authorities/authorities-home.pl">Authorities</a>
</li>
[% IF Koha.Preference('ILLModule') && CAN_user_ill %]
<li>
<a class="icon_general icon_ill" href="/cgi-bin/koha/ill/ill-requests.pl">ILL requests</a>
</li>
[% END %]
</ul>
</div> <!-- /.col-xs-6 -->
<div class="col-xs-6">
<ul class="biglinks-list">
[% IF ( CAN_user_editcatalogue_edit_catalogue || CAN_user_editcatalogue_edit_items ) %]
<li>
<a class="icon_general icon_cataloging" href="/cgi-bin/koha/cataloguing/addbooks.pl">Cataloging</a>
</li>
[% END %]
[% IF ( CAN_user_serials ) %]
<li>
<a class="icon_general icon_serials" href="/cgi-bin/koha/serials/serials-home.pl">Serials</a>
<span class="biglink"></span>
</li>
[% END %]
[% IF ( CAN_user_acquisition ) %]
<li>
<a class="icon_general icon_acquisitions" href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
<span class="biglink"></span>
</li>
[% END %]
[% IF ( CAN_user_reports ) %]
<li>
<a class="icon_general icon_reports" href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
</li>
[% END %]
[% IF ( CAN_user_tools ) %]
<li>
<a class="icon_general icon_tools" href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
</li>
[% END %]
[% IF ( CAN_user_parameters ) %]
<li>
<a class="icon_general icon_administration" href="/cgi-bin/koha/admin/admin-home.pl">Koha administration</a>
</li>
[% END %]
<li>
<a class="icon_general icon_koha" href="/cgi-bin/koha/about.pl">About Koha</a>
</li>
</ul>
</div> <!-- /.col-sm-6 -->
</div> <!-- /.row -->
<div class="row">
<div class="col-sm-12">
[%# Following statement must be in one line for translatability %]
[% IF ( ( CAN_user_tools_moderate_comments && pendingcomments ) || ( CAN_user_tools_moderate_tags && pendingtags ) || ( CAN_user_borrowers_edit_borrowers && pending_borrower_modifications ) || ( CAN_user_acquisition && pendingsuggestions ) || ( CAN_user_borrowers_edit_borrowers && pending_discharge_requests ) || pending_article_requests) || ( Koha.Preference('AllowCheckoutNotes') && CAN_user_circulate_manage_checkout_notes && pending_checkout_notes.count ) %]
<div id="area-pending">
[% IF pending_article_requests %]
<div class="pending-info" id="article_requests_pending">
<a href="/cgi-bin/koha/circ/article-requests.pl">Article requests</a>:
<span class="pending-number-link">[% pending_article_requests | html %]</span>
</div>
[% END %]
[% IF ( CAN_user_acquisition_suggestions_manage && pendingsuggestions ) %]
<div class="pending-info" id="suggestions_pending">
<a href="/cgi-bin/koha/suggestion/suggestion.pl#ASKED">Suggestions pending approval</a>:
<span class="pending-number-link">[% pendingsuggestions | html %]</span>
</div>
[% END %]
[% IF ( CAN_user_tools_moderate_comments && pendingcomments ) %]
<div class="pending-info" id="comments_pending">
<a href="/cgi-bin/koha/reviews/reviewswaiting.pl">Comments pending approval</a>:
<span class="pending-number-link">[% pendingcomments | html %]</span>
</div>
[% END %]
[% IF ( CAN_user_tools_moderate_tags && pendingtags ) %]
<div class="pending-info" id="tags_pending">
<a href="/cgi-bin/koha/tags/review.pl">Tags pending approval</a>:
<span class="pending-number-link">[% pendingtags | html %]</span>
</div>
[% END %]
[% IF ( CAN_user_borrowers_edit_borrowers && pending_borrower_modifications ) %]
<div class="pending-info" id="patron_updates_pending">
<a href="/cgi-bin/koha/members/members-update.pl">Patrons requesting modifications</a>:
<span class="pending-number-link">[% pending_borrower_modifications | html %]</span>
</div>
[% END %]
[% IF CAN_user_borrowers_edit_borrowers && pending_discharge_requests %]
<div class="pending-info" id="patron_discharges_pending">
<a href="/cgi-bin/koha/members/discharges.pl">Discharge requests pending</a>:
<span class="pending-number-link">[% pending_discharge_requests | html %]</span>
</div>
[% END %]
[% IF Koha.Preference('AllowCheckoutNotes') && CAN_user_circulate_manage_checkout_notes && pending_checkout_notes.count %]
<div class="pending-info" id="checkout_notes_pending">
<a href="/cgi-bin/koha/circ/checkout-notes.pl">Checkout notes pending</a>:
<span class="pending-number-link">[% pending_checkout_notes.count | html %]</span>
</div>
[% END %]
</div>
[% END %]
</div> <!-- /.col-sm-12 -->
</div> <!-- /.row -->
[% IF ( IntranetmainUserblock ) %]
<div class="row">
<div class="col-sm-12">
<div id="area-userblock">
<div class="user-info">
[% IntranetmainUserblock | $raw %]
</div>
</div>
</div>
</div>
[% END %]
</div> <!-- /.col-sm-9 -->
</div> <!-- /.row -->
</div> <!-- /.container-fluid -->
[% MACRO jsinclude BLOCK %]
<script type="text/javascript">
//<![CDATA[
var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this news item? This cannot be undone.");
$(document).ready(function(){
$(".news_delete").on("click", function(){
return confirmDelete(MSG_CONFIRM_DELETE);
});
});
//]]>
</script>
[% END %]
<!-- the main div is closed in intranet-bottom.inc -->
[% INCLUDE 'intranet-bottom.inc' %]