Bug 35570: (QA follow-up): Standard backend: Fix OPAC CSRF

Add FreeForm CSRF fix from 6a37ce0dab into this work.
This is to keep this work up to date with latest FreeForm's fixes.

The test plan to demonstrate the issue this patch fixes:
Test plan, k-t-d:

1) Install FreeForm, enable ILL module, run:
bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh)
2) You'll have to switch the FreeForm branch to the one compatible with this work, i.e.:
cd /kohadevbox/koha/Koha/Illbackends/FreeForm
git checkout b_36243
3) Restart plack:
koha-plack --restart kohadev
4) Go to OPAC ILL requests, login and visit:
<opac_url>/cgi-bin/koha/opac-illrequests.pl
5) Click "Create new request"
6) Change the 'type'. Notice you get a 403 error. Logs say:
Programming error - op 'add_form' must start with 'cud-' for POST
7) Apply patch. Restart plack. Repeat 6)
8) Notice the change type works as expected. Click "Create".
9) Notice the request is created as expected.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Pedro Amorim 2024-03-07 11:19:39 +00:00 committed by Katrin Fischer
parent fe6927f959
commit 408e0eb075
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 2 additions and 1 deletions

View File

@ -17,6 +17,7 @@
[% IF whole.stage == "form" %]
<h2>Create a manual ILL request</h2>
<form id="create_form" method="POST" action="">
[% INCLUDE 'csrf-token.inc' %]
<fieldset class="rows">
<legend>General details</legend>
<ol id="general-standard-fields">
@ -106,7 +107,7 @@
<input id="ill-submit" class="btn btn-default" type="submit" value="Create"/>
<a class="cancel" href="/cgi-bin/koha/opac-illrequests.pl">Cancel</a>
</fieldset>
<input type="hidden" name="method" value="create" />
<input type="hidden" name="op" value="cud-create" />
<input type="hidden" name="stage" value="form" />
<input type="hidden" name="backend" value="Standard" />
</form>