[Koha-bugs] [Bug 27849] Koha::Token may access undefined C4::Context->userenv

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Aug 1 10:12:05 CEST 2022


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

Marcel de Rooy <m.de.rooy at rijksmuseum.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #137802|0                           |1
        is obsolete|                            |

--- Comment #6 from Marcel de Rooy <m.de.rooy at rijksmuseum.nl> ---
Created attachment 138448
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=138448&action=edit
Bug 27849: Koha::Token may access undefined C4::Context->userenv

The _add_default_csrf_params internal function accesses
C4::Context->userenv without checking that it has been defined. I think
not all of the potential callers of it declare that they require a
defined userenv, so we should test and provide defaults for required
values if it is not defined, to avoid some "Can't use an undefined value
as a HASH reference" HTTP 500 Internal Server Errors.

To test:

Do anything that requires a form with CSRF token, such as editing your
details. Behaviour should be unchanged. To test the failure case, you
would need some customised code that indirectly generates a CSRF token
before setting the userenv up and I am not sure there is any in released
Koha yet.

Signed-off-by: Paul Derscheid <paul.derscheid at lmscloud.de>

Looks good to me. Working as expected.

Signed-off-by: Marcel de Rooy <m.de.rooy at rijksmuseum.nl>

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list