Bugzilla – Attachment 177685 Details for
Bug 28907
Potential unauthorized access in public REST routes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[24.05.x] Bug 28907: REST - Remove allow-owner from public checkout availability route
2405x-Bug-28907-REST---Remove-allow-owner-from-pub.patch (text/plain), 1.85 KB, created by
Lari Taskula
on 2025-02-10 13:01:54 UTC
(
hide
)
Description:
[24.05.x] Bug 28907: REST - Remove allow-owner from public checkout availability route
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2025-02-10 13:01:54 UTC
Size:
1.85 KB
patch
obsolete
>From fe480fa9c12565b47afb711197f1be63c4ad9965 Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@hypernova.fi> >Date: Wed, 18 Sep 2024 11:13:23 +0000 >Subject: [PATCH] [24.05.x] Bug 28907: REST - Remove allow-owner from public > checkout availability route > >To test: >1. prove t/db_dependent/api/v1/checkouts.t >2. Apply patch >3. prove t/db_dependent/api/v1/checkouts.t > >Observe success in both cases. > >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/REST/V1/Checkouts.pm | 11 ++++++++++- > api/v1/swagger/paths/checkouts.yaml | 2 -- > 2 files changed, 10 insertions(+), 3 deletions(-) > >diff --git a/Koha/REST/V1/Checkouts.pm b/Koha/REST/V1/Checkouts.pm >index 793453613e..086fa68022 100644 >--- a/Koha/REST/V1/Checkouts.pm >+++ b/Koha/REST/V1/Checkouts.pm >@@ -153,7 +153,16 @@ sub get_availability { > my $c = shift->openapi->valid_input or return; > my $user = $c->stash('koha.user'); > >- my $patron = Koha::Patrons->find( $c->param('patron_id') ); >+ my $patron_id = $c->param('patron_id'); >+ >+ return if try { >+ $c->auth->public($patron_id) if $c->stash('is_public'); >+ return 0; # authorization successful, do not "return" after try-catch >+ } catch { >+ return $c->unhandled_exception($_); >+ }; >+ >+ my $patron = Koha::Patrons->find($patron_id); > my $item = Koha::Items->find( $c->param('item_id') ); > > my ( $impossible, $confirmation, $warnings ) = >diff --git a/api/v1/swagger/paths/checkouts.yaml b/api/v1/swagger/paths/checkouts.yaml >index 24199736e1..6afadce078 100644 >--- a/api/v1/swagger/paths/checkouts.yaml >+++ b/api/v1/swagger/paths/checkouts.yaml >@@ -447,5 +447,3 @@ > description: Under maintenance > schema: > $ref: "../swagger.yaml#/definitions/error" >- x-koha-authorization: >- allow-owner: true >-- >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 28907
:
171666
|
171667
|
171668
|
171669
|
171670
|
171671
|
171672
|
171673
|
171674
|
172434
|
172435
|
172436
|
172437
|
172438
|
172439
|
172440
|
172441
|
172442
|
174662
|
174663
|
174664
|
174665
|
174666
|
174667
|
174668
|
174669
|
174670
|
176708
|
176709
|
176710
|
176711
|
176712
|
176713
|
176714
|
176715
|
176716
|
177679
|
177680
|
177681
|
177682
|
177683
|
177684
|
177685
|
177686
|
177687
|
179000