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

150 lines
9 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE KohaDates %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Tools &rsaquo; Plugins </title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="plugins_plugins_home" class="plugins">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'prefs-admin-search.inc' %]
<div id="breadcrumbs">
<a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
<a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
Plugins
</div>
<div id="doc3" class="yui-t1">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<div class="details">
[% IF ( CAN_user_plugins_manage ) %]
<div class="btn-toolbar" id="toolbar">
<a href="/cgi-bin/koha/plugins/plugins-upload.pl" id="upload_plugin" class="btn btn-default btn-sm"><i class="fa fa-upload"></i> Upload plugin</a>
<div class="btn-group">
<button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"><i class="fa fa-eye"></i> View plugins by class <span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a href="/cgi-bin/koha/plugins/plugins-home.pl">View all plugins</a></li>
<li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=report">View report plugins</a></li>
<li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=tool">View tool plugins</a></li>
<li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=to_marc">View MARC conversion plugins</a></li>
<li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=opac_online_payment">View online payment plugins</a></li>
</ul>
</div>
</div>
[% END %]
<h1>Plugins</h1>
[% UNLESS ( plugins ) %]
[% UNLESS ( method ) %]
<div class="dialog message">No plugins installed</div>
[% ELSE %]
[% IF method == 'tool' %]
<div class="dialog message">No plugins that can be used as a tool are installed</div>
[% ELSIF method == 'report' %]
<div class="dialog message">No plugins that can create a report are installed</div>
[% ELSIF method == 'to_marc' %]
<div class="dialog message">No plugins that can convert files to MARC records are installed</div>
[% ELSIF method == 'opac_online_payment' %]
<div class="dialog message">No plugins that can process online payments via the public catalog are installed</div>
[% ELSE %]
<div class="dialog message">Unknown plugin type <i>[% method | html %]</i></div>
[% END %]
[% END %]
[% ELSE %]
<table>
<tr>
<th>Name</th>
<th>Description</th>
<th>Author</th>
<th>Plugin version</th>
<th>Minimum Koha version</th>
<th>Maximum Koha version</th>
<th>Last updated</th>
[% IF ( CAN_user_plugins_configure || CAN_user_plugins_manage || CAN_user_plugins_report || CAN_user_plugins_tool ) %]
<th>Actions</th>
[% END %]
</tr>
[% FOREACH plugin IN plugins %]
<tr>
<td><strong>[% plugin.metadata.name | html %]</strong></td>
<td>
[% plugin.metadata.description | html %]
[% IF ( plugin.metadata.minimum_version && koha_version < plugin.metadata.minimum_version ) %]
<div class="error">Warning: This report was written for a newer version of Koha. Run at your own risk.</div>
[% END %]
[% IF ( plugin.metadata.maximum_version && koha_version > plugin.metadata.maximum_version ) %]
<div class="error">Warning: This report was written for an older version of Koha. Run at your own risk.</div>
[% END %]
</td>
<td>[% plugin.metadata.author | html %]</td>
<td>[% plugin.metadata.version | html %]</td>
<td>[% plugin.metadata.minimum_version | html %]</td>
<td>[% plugin.metadata.maximum_version | html %]</td>
<td>[% plugin.metadata.date_updated | $KohaDates %]</td>
[% IF ( CAN_user_plugins_configure || CAN_user_plugins_manage || CAN_user_plugins_report || CAN_user_plugins_tool ) %]
<td class="actions">
<div class="dropdown">
<a class="btn btn-default btn-xs dropdown-toggle" id="pluginactions[% plugin.class | html %]" role="button" data-toggle="dropdown" href="#">
Actions <b class="caret"></b>
</a>
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="pluginactions[% plugin.class | html %]">
[% IF ( CAN_user_plugins_report ) %]
[% IF plugin.can('report') %]
<li><a href="/cgi-bin/koha/plugins/run.pl?class=[% plugin.class | html %]&method=report"><i class="fa fa-table"></i> Run report</a></li>
[% END %]
[% END %]
[% IF ( CAN_user_plugins_tool ) %]
[% IF plugin.can('tool') %]
<li><a href="/cgi-bin/koha/plugins/run.pl?class=[% plugin.class | html %]&method=tool"><i class="fa fa-wrench"></i> Run tool</a></li>
[% END %]
[% END %]
[% IF ( CAN_user_plugins_configure ) %]
[% IF plugin.can('configure') %]
<li><a href="/cgi-bin/koha/plugins/run.pl?class=[% plugin.class | html %]&method=configure"><i class="fa fa-cog"></i> Configure</a></li>
[% END %]
[% END %]
[% IF ( CAN_user_plugins_manage ) %]
<li><a class="uninstall_plugin" data-plugin-name="[% plugin.metadata.name | html %]" href="/cgi-bin/koha/plugins/plugins-uninstall.pl?class=[% plugin.class | html %]"><i class="fa fa-trash"></i> Uninstall</a></li>
[% END %]
</ul>
</div>
</td>
[% END %]
[% END %]
</table>
[% END %]
</div>
</div>
</div>
<div class="yui-b noprint">
[% INCLUDE 'tools-menu.inc' %]
</div>
</div>
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/tools-menu.js") | $raw %]
[% INCLUDE 'calendar.inc' %]
<script type="text/javascript">
$(document).ready(function(){
$(".uninstall_plugin").on("click", function(){
$(".dropdown").removeClass("open");
var plugin_name = $(this).data("plugin-name");
return confirmDelete( _("Are you sure you want to uninstall the plugin %s?").format( plugin_name ) );
});
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]