Bugzilla – Attachment 162733 Details for
Bug 36193
CSRF - Code review missed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36193: Fix acq receiving
Bug-36193-Fix-acq-receiving.patch (text/plain), 2.13 KB, created by
Tomás Cohen Arazi (tcohen)
on 2024-03-04 21:00:25 UTC
(
hide
)
Description:
Bug 36193: Fix acq receiving
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2024-03-04 21:00:25 UTC
Size:
2.13 KB
patch
obsolete
>From 87c5ef0c943e4a73659e04fe117e6e64a80fb891 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 4 Mar 2024 17:44:59 -0300 >Subject: [PATCH] Bug 36193: Fix acq receiving > >This patch addresses the CSRF error when receiving in acquisitions. > >To test: >1. Have at least one order to receive >2. Follow the steps to receive them >3. Have the logs open: > $ ktd --shell > k$ tail -f /var/log/koha/kohadev/*.log >4. Click to confirm receipt >=> FAIL: An error modal is displayed >=> FAIL: There's an error about missing CSRF token in POST >5. Apply this patch >6. Reload everything: > k$ restart_all >7. Repeat 1-4 >=> SUCCESS: Receipt works :-D >=> SUCCESS: No error log >8. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > acqui/finishreceive.pl | 9 +++++++-- > .../intranet-tmpl/prog/en/modules/acqui/orderreceive.tt | 1 + > 2 files changed, 8 insertions(+), 2 deletions(-) > >diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl >index a9803b85425..8419ac30be9 100755 >--- a/acqui/finishreceive.pl >+++ b/acqui/finishreceive.pl >@@ -36,9 +36,14 @@ use Koha::Number::Price; > use Koha::Acquisition::Booksellers; > use Koha::Acquisition::Orders; > >+my $input = CGI->new; > >-my $input=CGI->new; >-my $flagsrequired = {acquisition => 'order_receive'}; >+if ( $input->request_method ne "POST" ) { >+ print $input->header( -status => 400 ); >+ exit; >+} >+ >+my $flagsrequired = { acquisition => 'order_receive' }; > > checkauth($input, 0, $flagsrequired, 'intranet'); > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >index 15bf01efeed..9b76cce5203 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >@@ -681,6 +681,7 @@ > [% END %] > > var _doSave = function(params) { >+ params.data.csrf_token = $('meta[name="csrf-token"]').attr('content'); > $.ajax($.extend({ > method: 'POST', > url: '/cgi-bin/koha/acqui/finishreceive.pl' >-- >2.44.0
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 36193
:
162684
|
162733
|
162734
|
162749
|
162750
|
162751
|
162752
|
162755
|
162769
|
162770
|
162771
|
162772
|
162773
|
162774
|
162775
|
162776
|
162777
|
162784
|
162830
|
162831
|
162837