https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42876

--- Comment #2 from Jonathan Druart <[email protected]> ---
Created attachment 200649
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200649&action=edit
Bug 42876: Fetch a new CSRF token every 6 hours

The CSRF token expires after 8 hours
Koha/Token.pm
64 use constant CSRF_EXPIRY_HOURS   => 8;             # 8 hours instead of 7
days..

The session expires after 1 day by default
C4/Auth.pm
816     my $timeout         = C4::Context->preference('timeout') ||
$default_timeout;

This patch suggests to fetch a new CSRF token every 6 hours so that Vue
apps users can continue to use the logged in session without getting 403
and needed to refresh the app.

Test plan:
1. edit koha-tmpl/intranet-tmpl/prog/js/fetch/koha-api-client.js
Locate line 219 `6 * 3600 * 1000`
Replace with 10000 (for 10 seconds)

2. Rebuild
% yarn api:bundle && yarn js:build && koha-plack --reload kohadev

3. Open the browser console, tab "Network"
4. Hit /cgi-bin/koha/erm/agreements
5. Notice that a successful request to /auth/csrf is made every 10
   seconds
6. Open the inspector, locate the meta tag (within head) that contains
   the CSRF token. Notice that it is updated every 10 seconds

Assisted-by: Mistral Vibe <[email protected]>
For the JS 'interval' code

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to