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

--- Comment #5 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 208603
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208603&action=edit
Bug 43782: (RM follow-up) Return nothing from GenerateCSRF when there is no
session

Bug 43782 builds the cache key for the CSRF token from the session id,
but GenerateCSRF is also rendered, through csrf-token.inc, in templates
that have no sessionID in their stash. It then warned twice:

  Use of uninitialized value $session_id in concatenation (.) or string
  Use of uninitialized value $csrf_token in concatenation (.) or string

which fails t/db_dependent/Koha/Plugins/TemplateIncludePathHook.t on its
"no warnings" check, and cached a token under a session-less key.

A CSRF token is bound to a session, and Koha::Token->generate_csrf
already returns nothing when it is not given one, as GenerateCSRF did
before bug 43782. Return early in the same way, before the cache key is
built.

Test plan:
1. prove t/db_dependent/Koha/Plugins/TemplateIncludePathHook.t
   => it passes (it failed with "not ok 6 - no warnings")
2. prove t/db_dependent/Koha/Template/Plugin/Koha.t
   => it passes, including the new 'GenerateCSRF - No session' subtest

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Martin Renvoize <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to