diff --git a/t/Template/Utils.t b/t/Template/Utils.t index 0f1a9ed307..a22683c53b 100755 --- a/t/Template/Utils.t +++ b/t/Template/Utils.t @@ -18,7 +18,8 @@ # along with Koha; if not, see . use Modern::Perl; -use Test::More tests => 3; +use Test::NoWarnings; +use Test::More tests => 4; use utf8; @@ -58,3 +59,24 @@ subtest 'Plugin related tests' => sub { "Processing template toolkit with a Koha plugin works" ); }; + +subtest 'Security-related tests' => sub { + plan tests => 2; + + is( + Koha::TemplateUtils::process_tt( + q{[% USE dir = Directory('/') ~%] +[% FOREACH entry IN dir.list ~%] +

[% entry.abs %]

+[% END %]}, + ), + q{}, + "Plugins not allowed for User-entered TT" + ); + + is( + Koha::TemplateUtils::process_tt(q{[% USE raw %][% 'foo' | $raw %]}), + q{foo}, + "Koha plugins are still available" + ); +};