Koha-clms/misc
Nick Clemens 921c4a43b5 Bug 38382: Fresh connection when connexion CSRF token expires
This patch simply generates a new user agent when reauthenticating when the CSRF token
for the session has expired.

To test:
1 - Edit Koha/Token.pm, line 275
from:    { MaxAge => $params->{MaxAge} // ( CSRF_EXPIRY_HOURS * 3600 ) },
to:      { MaxAge => $params->{MaxAge} // ( CSRF_EXPIRY_HOURS ) },
2 - This will make your CSRF tokens expire after 8 seconds
3 - vim /etc/koha/sites/kohadev/connexion.cnf
4 - Set content:
    host:
    port: 8888
    koha:http://localhost:8081
    log:/var/log/koha/kohadev/connexion.log
    match:ISBN
    user:kohauser
    password:kohapass
    overlay_action:replace
    nomatch_action:create_new
    item_action:always_add
    import_mode:direct
    framework:BKS
    overlay_framework:
    debug:1
5 - Save the sample file from this bug into your kohaclone (or copy and paste into a file your koha test site can reach)
6 - On the command line:
    perl misc/bin/connexion_import_daemon.pl -c /etc/koha/sites/kohadev/connexion.cnf
7 - In another terminal:
    cat bug_33418.test  | nc -v localhost 8888
8 - Successful request
9 - Wait 10 seconds (more than 8 anyways)
10 - Repeat 7
11 - Unsuccessful request - Invalid CSRF token
12 - Ctrl+C to stop the connexion daemon
13 - Apply patch
14 - repeat 6
15 - repeat 7, success
16 - Wait more than 8 seconds
17 - repeat 7, success!
18 - repeat again until you are satisfied
19 - Sign off!

WNC amended and tidied

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e758492d99)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
2025-03-20 00:42:42 +00:00
..
admin Bug 31325: Fix koha-preferences get 2022-08-16 09:11:40 -03:00
bin Bug 38382: Fresh connection when connexion CSRF token expires 2025-03-20 00:42:42 +00:00
cronjobs Bug 38237: Add POD 2024-11-20 18:41:50 +00:00
devel Bug 36309: Make create_superlibrarian.pl output more useful 2024-04-22 08:57:35 +02:00
interface_customization
…
maintenance Bug 37790: Add skip indexing and holds queue options and verbosity to update localuse script 2024-12-05 22:41:21 +00:00
migration_tools Revert "Bug 37478: Add strict mode to bulkmarcimport" 2024-12-27 09:29:55 +13:00
release_notes Add number of security bugs to the 24.05.07 release notes 2025-02-26 20:04:32 +00:00
search_tools Bug 35345: Add --where option to rebuild_elasticsearch.pl 2024-04-22 12:39:26 +02:00
translator Bug 38085: Pick multiple_sortable options for translation 2024-11-20 23:30:45 +00:00
workers Bug 37787: Remove mention of elastic_index from POD 2024-11-20 18:32:53 +00:00
add_date_fields_to_marc_records.pl Bug 23924: Reset the fields to add 2023-05-05 12:13:53 -03:00
add_statistics_borrowers_categorycode.pl Bug 34478: op =~ ^cud- in pl/pm 2024-03-01 10:56:11 +01:00
batchCompareMARCvsFrameworks.pl Bug 28617: Remove kohalib.pl and rely on PERL5LIB 2021-12-07 12:16:28 -10:00
batchDeleteUnusedSubfields.pl Bug 28617: Remove kohalib.pl and rely on PERL5LIB 2021-12-07 12:16:28 -10:00
batchImportMARCWithBiblionumbers.pl Bug 28617: Remove kohalib.pl and rely on PERL5LIB 2021-12-07 12:16:28 -10:00
batchRebuildBiblioTables.pl Bug 30813: Update TransformMarcToKoha to accept a hashref 2022-06-08 11:40:29 -03:00
batchRebuildItemsTables.pl Bug 29697: Use flag embed_items 2022-07-22 15:24:11 -03:00
batchRepairMissingBiblionumbers.pl Bug 29697: Replace GetMarcBiblio occurrences with $biblio->metadata->record 2022-07-22 15:24:11 -03:00
batchdeletebiblios.pl
…
check_sysprefs.pl
…
commit_file.pl Bug 15869: Change framework on overlay 2023-02-07 10:32:22 -03:00
export_borrowers.pl Bug 33339: Prevent Formula Injection (CSV Injection) in CSV files 2024-11-07 23:02:54 +00:00
export_records.pl Bug 31286: Embed see-from headings into bibliographic records export 2024-03-25 09:53:24 +01:00
exportauth.pl Bug 28617: Remove kohalib.pl and rely on PERL5LIB 2021-12-07 12:16:28 -10:00
import_patrons.pl Bug 34621: Tidy import_patrons.pl 2024-04-12 14:02:43 +02:00
koha-install-log
…
link_bibs_to_authorities.pl Bug 30024: Make link_bibs_to_authorities.pl rely on LinkerRelink 2023-11-03 14:22:45 -03:00
load_yaml.pl
…
mod_zebraqueue.pl
…
process_ill_updates.pl Bug 35581: Koha::Illrequest -> Koha::ILL::Request 2024-04-22 08:57:45 +02:00
recreateIssueStatistics.pl Bug 34478: op =~ ^cud- in pl/pm - Manual revert changes to recreateIssueStatistics.pl 2024-03-01 10:57:15 +01:00
sax_parser_print.pl
…
sax_parser_test.pl
…
sip_cli_emulator.pl Bug 23426: (follow-up) Enhance sip_cli_emulator.pl for test plan 2024-12-05 22:50:42 +00:00
stage_file.pl Bug 28617: Remove kohalib.pl and rely on PERL5LIB 2021-12-07 12:16:28 -10:00
z3950_responder.pl
…