Bug 29264: SIP config allows use of non-branchcode institution ids causes workers...
authorKyle M Hall <kyle@bywatersolutions.com>
Mon, 18 Oct 2021 12:28:27 +0000 (12:28 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 15 Nov 2021 11:38:39 +0000 (12:38 +0100)
commite9bc90ebb0dfa5c9724e7473b4003275c0313d7f
treea27ed621232aa36abc70ac210a7f4cb46a7cd00d
parent3cca6f444084621e9b84489a2615368d2af189fe
Bug 29264: SIP config allows use of non-branchcode institution ids causes workers to die without responding

If is entirely possible to create an SIP institution whose ID does not match a valid branchcode in Koha's SIP config. In fact, Koha's example SIP config contains an example of this ( kohalibrary / kohalibrary2 ).

If a SIP login uses an institution with an id that doesn't match a valid branchcode, everything will appear to work, but the SIP worker will die anywhere that Koha gets the branch from the userenv and assumes it is valid.

The repercussions of this are that actions such as the checkout message simply die and do not return a response message to the requestor.

At the very least, we should output a warning to the SIP log.

I think we should strongly consider disallowing institution ids in the SIP config that do not match valid branchcodes. In this scenario, attempting to start the SIP server should result in a error message with the SIP server exiting immediately.

Test Plan:
1) Apply this patch
2) Make a sip login that uses an instution whose id is *not* a valid branchcode
3) Start the SIP server
4) Check sip.log, you should see a warning similar to the following:
[2021/10/18 12:18:29] [2068079] [ERROR] ERROR: Institution kohalibrary does does not match a branchcode. This can cause unexpected behavior. C4::SIP::Sip::siplog /kohadevbox/koha/C4/SIP/Sip.pm (220)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
C4/SIP/SIPServer.pm
C4/SIP/Sip/Configuration.pm