From 9cac08f749619057b013326bc9a72c97446a9750 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 3 Apr 2026 13:53:52 +0200 Subject: [PATCH] Bug 42136: Add tests Signed-off-by: Jonathan Druart Signed-off-by: Lucas Gass --- t/Template/Utils.t | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/t/Template/Utils.t b/t/Template/Utils.t index 5c356cd9df..fa5b884571 100755 --- a/t/Template/Utils.t +++ b/t/Template/Utils.t @@ -19,7 +19,7 @@ use Modern::Perl; use Test::NoWarnings; -use Test::More tests => 4; +use Test::More tests => 5; use utf8; @@ -59,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" + ); +};