Bug 42136: Add tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2026-04-03 13:53:52 +02:00 committed by Lucas Gass
parent 268863392e
commit 9cac08f749
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 22 additions and 1 deletions

View File

@ -19,7 +19,7 @@
use Modern::Perl; use Modern::Perl;
use Test::NoWarnings; use Test::NoWarnings;
use Test::More tests => 4; use Test::More tests => 5;
use utf8; use utf8;
@ -59,3 +59,24 @@ subtest 'Plugin related tests' => sub {
"Processing template toolkit with a Koha plugin works" "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 ~%]
<p>[% entry.abs %]</p>
[% 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"
);
};