Bugzilla – Attachment 166861 Details for
Bug 36520
SQL Injection in opac-sendbasket.pl (CVE-2024-36058)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36520: Add tests
Bug-36520-Add-tests.patch (text/plain), 2.45 KB, created by
Marcel de Rooy
on 2024-05-17 06:48:20 UTC
(
hide
)
Description:
Bug 36520: Add tests
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2024-05-17 06:48:20 UTC
Size:
2.45 KB
patch
obsolete
>From 3495b77be50502376fa9ff92c76881a3cbfb14c3 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 15 May 2024 11:25:47 +0200 >Subject: [PATCH] Bug 36520: Add tests >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/Letters.t | 40 +++++++++++++++++++++++++++++++++++++++- > 1 file changed, 39 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Letters.t b/t/db_dependent/Letters.t >index ea1e859456..fbfabe16bb 100755 >--- a/t/db_dependent/Letters.t >+++ b/t/db_dependent/Letters.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > use File::Basename qw(dirname); >-use Test::More tests => 100; >+use Test::More tests => 101; > use Test::MockModule; > use Test::Warn; > use Test::Exception; >@@ -1524,3 +1524,41 @@ subtest 'Template toolkit syntax in parameters' => sub { > 'Template toolkit syntax in parameter was not evaluated.' > ); > }; >+ >+subtest 'Quote user params in GetPreparedLetter' => sub { >+ plan tests => 1; >+ >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ my $biblio = $builder->build_sample_biblio; >+ my %loops = ( biblio => [ $biblio->biblionumber . ') AND (SELECT 1 FROM (SELECT(SLEEP(10)))x)-- -' ] ); >+ my %substitute = ( comment => 'some comment' ); >+ >+ Koha::Notice::Template->new( >+ { >+ module => 'catalogue', >+ code => 'CART', >+ branchcode => '', >+ message_transport_type => 'email', >+ content => >+ 'Hello [% borrower.firstname %], Some comments about those biblios [% FOR b IN biblios %][% biblio.title %][% END %]: [% comment %]', >+ } >+ )->store; >+ >+ my $t = time; >+ my $letter = C4::Letters::GetPreparedLetter( >+ module => 'catalogue', >+ letter_code => 'CART', >+ tables => { >+ borrowers => $patron->borrowernumber, >+ }, >+ message_transport_type => 'email', >+ loops => \%loops, >+ substitute => \%substitute, >+ ); >+ my $exec_time = time - $t; >+ ok( $exec_time < 10, "We should not exec the SLEEP" ) >+ or diag sprintf( >+ "Spent %ss to run GetPreparredLetter, SLEEP has certainly been executed which could lead to SQL injections", >+ $exec_time >+ ); >+}; >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36520
:
166614
|
166617
|
166618
|
166620
|
166632
|
166633
|
166635
|
166646
|
166650
|
166760
|
166761
|
166762
|
166795
|
166796
|
166797
| 166861 |
166862
|
166863