Bugzilla – Attachment 166795 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.38 KB, created by
Victor Grousset/tuxayo
on 2024-05-15 23:15:29 UTC
(
hide
)
Description:
Bug 36520: Add tests
Filename:
MIME Type:
Creator:
Victor Grousset/tuxayo
Created:
2024-05-15 23:15:29 UTC
Size:
2.38 KB
patch
obsolete
>From 8d9763a3f6b233104fcb28de9e34aee52b8371a5 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 > >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> >--- > 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 8ae4bcd3e2..ccbb00cac2 100755 >--- a/t/db_dependent/Letters.t >+++ b/t/db_dependent/Letters.t >@@ -18,7 +18,7 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >-use Test::More tests => 100; >+use Test::More tests => 101; > use Test::MockModule; > use Test::Warn; > use Test::Exception; >@@ -1523,3 +1523,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.45.1
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