Bug 38829: Add a test

Signed-off-by: Magnus Enger <magnus@libriotech.no>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Added a shebang line.
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Jonathan Druart 2025-01-06 14:26:00 +01:00 committed by Katrin Fischer
parent 31ff6b69df
commit 943cc3ec2a
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 12 additions and 1 deletions

View File

@ -1,5 +1,7 @@
#!/usr/bin/perl
use Modern::Perl;
use Test::More tests => 17;
use Test::More tests => 18;
use C4::Acquisition;
use C4::Budgets qw( AddBudgetPeriod AddBudget );
@ -168,3 +170,12 @@ my $today = output_pref( { dt => dt_from_string, dateformat => 'iso', dateonly =
# FIXME: This test should pass. The GetLateOrMissingIssues should not deal with date format!
#is( $serial_claimed->{claimdate}, $today, 'The serial should have been claimed today' );
subtest 'prevent SQL injections' => sub {
plan tests => 1;
my $time1 = time;
my $hack = q|1 OR (SELECT 1 FROM (SELECT(SLEEP(10)))x)-- -|;
GetLateOrMissingIssues($hack);
my $time2 = time;
ok( $time2 < $time1 + 10, 'The sleep should not be executed' );
};