Bugzilla – Attachment 167772 Details for
Bug 37018
SQL injection using q under api/
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37018: (follow-up) throw a 500 error when an invalid query is found
Bug-37018-follow-up-throw-a-500-error-when-an-inva.patch (text/plain), 1.80 KB, created by
Hammat wele
on 2024-06-14 21:44:57 UTC
(
hide
)
Description:
Bug 37018: (follow-up) throw a 500 error when an invalid query is found
Filename:
MIME Type:
Creator:
Hammat wele
Created:
2024-06-14 21:44:57 UTC
Size:
1.80 KB
patch
obsolete
>From 7144c62c272dd2b14e956a55ef2244ed55caa784 Mon Sep 17 00:00:00 2001 >From: Hammat Wele <hammat.wele@inlibro.com> >Date: Fri, 14 Jun 2024 21:44:14 +0000 >Subject: [PATCH] Bug 37018: (follow-up) throw a 500 error when an invalid > query is found > >--- > Koha/REST/Plugin/Query.pm | 4 ---- > t/Koha/REST/Plugin/Query.t | 4 ++-- > 2 files changed, 2 insertions(+), 6 deletions(-) > >diff --git a/Koha/REST/Plugin/Query.pm b/Koha/REST/Plugin/Query.pm >index becc5419ef..fd0b17b0c4 100644 >--- a/Koha/REST/Plugin/Query.pm >+++ b/Koha/REST/Plugin/Query.pm >@@ -203,10 +203,6 @@ Validate operators in the passed query. > _validate_query( $args->{filtered_params} ); > } catch { > if ( blessed $_ && $_->isa('Koha::Exceptions::BadParameter') ) { >- $c->render( >- status => 400, >- json => { error => $_->error } >- ); > Koha::Exceptions::BadParameter->throw( $_->error ); > } > }; >diff --git a/t/Koha/REST/Plugin/Query.t b/t/Koha/REST/Plugin/Query.t >index 55385ac237..75a3bac7a7 100755 >--- a/t/Koha/REST/Plugin/Query.t >+++ b/t/Koha/REST/Plugin/Query.t >@@ -218,7 +218,7 @@ get '/dbic_validate_operators' => sub { > } > catch { > $c->render( >- status => 400, >+ status => 500, > json => { error => "$_" } > ); > }; >@@ -689,7 +689,7 @@ subtest 'dbic_validate_operators' => sub { > # Invalid queries > $q = [ { "-and" => [ [ { "biblio_id" => { "like(sleep(1/100000))or" => "%a%" } } ] ] } ]; > $t->get_ok( '/dbic_validate_operators' => json => { q => $q } ) >- ->status_is(400) >+ ->status_is(500) > ->json_is( '/error' => > qq{Exception 'Koha::Exceptions::BadParameter' thrown 'Invalid operator in query: like(sleep(1/100000))or'\n} > ); >-- >2.34.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 37018
:
167440
|
167441
|
167442
|
167446
|
167447
|
167448
|
167449
|
167603
|
167672
|
167691
|
167772
|
168458
|
168582
|
168583
|
168584
|
168585
|
168586
|
168587
|
168616
|
168617
|
168618
|
168619
|
168620
|
168621
|
168622
|
168624
|
168626
|
168627
|
168628
|
168629
|
168630
|
168631
|
168632
|
168633
|
168634
|
168635
|
168654
|
168655
|
168656
|
168657
|
168658
|
168659
|
168660
|
168661
|
168662
|
168695
|
168696
|
168697
|
168698
|
168699
|
168700
|
168701
|
168702
|
168703
|
168704
|
168786
|
168787
|
168788
|
168789
|
168790
|
168791
|
168792
|
168793
|
168794
|
168795
|
169309
|
169337
|
169338
|
169339
|
169340
|
169341
|
169342
|
169343
|
169344
|
169345
|
169346
|
169368
|
169369
|
169370
|
169371
|
169372
|
169373
|
169374
|
169375
|
169376
|
169377
|
169378
|
169414
|
169832
|
169833
|
169834
|
169835
|
169836
|
169837
|
169838
|
169839
|
169840
|
169841