[Bug 38810] New: SIP account level system preference overrides not properly cleared between requests
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38810 Bug ID: 38810 Summary: SIP account level system preference overrides not properly cleared between requests Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: SIP2 Assignee: koha-bugs@lists.koha-community.org Reporter: kyle@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org Account level syspref overrides in SIP will "leak" between SIP requests. Basically an account level system preference override will may be set by a given request, but those overrides will never be cleared for the life of that SIP process thus "contaminating" that process until it reaches end of life". This is because the code # Clear overrides from previous message handling first foreach my $key ( keys %ENV ) { delete $ENV{$key} if index($key, 'OVERRIDE_SYSPREF_') > 0; } is checking if the env key contains the substring OVERRIDE_SYSPREF_ at an index greater than 0. The problem is that for all overrides the subtring *starts at 0* since it's always the first part of the string. If the substring is not part of the string index will return -1. TLDR we have an "off by one" error. We need to check that the return value is non-negative instead of positive. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38810 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |kyle@bywatersolutions.com |ity.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38810 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |20954 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20954 [Bug 20954] Add ability to set syspref overrides in SIP as we can in Apache -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38810 --- Comment #1 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- I will amend my solution. Since the string will always start with OVERRIDE_SYSPREF_ we just need to verify if the return value is 0, not non-negative. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38810 --- Comment #2 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 176056 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=176056&action=edit Bug 38810 - SIP account level system preference overrides not properly cleared between requests Account level syspref overrides in SIP will "leak" between SIP requests. Basically an account level system preference override will may be set by a given request, but those overrides will never be cleared for the life of that SIP process thus "contaminating" that process until it reaches end of life". This is because the code # Clear overrides from previous message handling first foreach my $key ( keys %ENV ) { delete $ENV{$key} if index($key, 'OVERRIDE_SYSPREF_') > 0; } is checking if the env key contains the substring OVERRIDE_SYSPREF_ at an index greater than 0. The problem is that for all overrides the subtring *starts at 0* since it's always the first part of the string. If the substring is not part of the string index will return -1. TLDR we have an "off by one" error. We need to check that the return value is zero instead of any positive value. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38810 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38810 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #176056|0 |1 is obsolete| | --- Comment #3 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 176096 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=176096&action=edit Bug 38810 - SIP account level system preference overrides not properly cleared between requests Account level syspref overrides in SIP will "leak" between SIP requests. Basically an account level system preference override will may be set by a given request, but those overrides will never be cleared for the life of that SIP process thus "contaminating" that process until it reaches end of life". This is because the code # Clear overrides from previous message handling first foreach my $key ( keys %ENV ) { delete $ENV{$key} if index($key, 'OVERRIDE_SYSPREF_') > 0; } is checking if the env key contains the substring OVERRIDE_SYSPREF_ at an index greater than 0. The problem is that for all overrides the subtring *starts at 0* since it's always the first part of the string. If the substring is not part of the string index will return -1. TLDR we have an "off by one" error. We need to check that the return value is zero instead of any positive value. 1) Set your SIP server params so that only one SIP process should run, <server-params min_servers='1' min_spare_servers='0' max_spare_servers='0' max_servers='0' custom_tcp_keepalive='0' custom_tcp_keepalive_time='7200' custom_tcp_keepalive_intvl='75' /> 2) Set noissuescharge to $5 3) Create two SIP accounts 4) Set an account level override for noissuescharge to $500 5) Create a patron that owes $10 in fines 6) Run a patron information request on the "normal" SIP account for the patron, the patron flags should show the patron being not able to check out items 7) Run a patron information request of the "overridden" SIp account for the patron, the patron flags should show the patron being allowed to check out items 8) Run a second patron information request on the "normal" SIP account for the patron, the patron flags should show the patron being able to check out even though they should not be able to check out 9) Apply this patch 10) Restart all the things! 11) Repeast steps 6-8 12) The flags should be correct! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38810 Katie Bliss <kebliss@dmpl.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kebliss@dmpl.org -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38810 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #4 from David Nind <david@davidnind.com> --- Could you provide an example request for step 6? SIP is still a bit of a mystery to me 8-) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38810 --- Comment #5 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- (In reply to David Nind from comment #4)
Could you provide an example request for step 6?
SIP is still a bit of a mystery to me 8-)
You can use the SIP cli tester: misc/sip_cli_emulator.pl --address 127.0.0.1 --port 6001 --sip_user koha --sip_pass koha --location MPL --terminator CR --message patron_informatio --patron $CARDNUMBER -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38810 Jake Deery <jake.deery@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #176096|0 |1 is obsolete| | --- Comment #6 from Jake Deery <jake.deery@ptfs-europe.com> --- Created attachment 176153 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=176153&action=edit Bug 38810 - SIP account level system preference overrides not properly cleared between requests Account level syspref overrides in SIP will "leak" between SIP requests. Basically an account level system preference override will may be set by a given request, but those overrides will never be cleared for the life of that SIP process thus "contaminating" that process until it reaches end of life". This is because the code # Clear overrides from previous message handling first foreach my $key ( keys %ENV ) { delete $ENV{$key} if index($key, 'OVERRIDE_SYSPREF_') > 0; } is checking if the env key contains the substring OVERRIDE_SYSPREF_ at an index greater than 0. The problem is that for all overrides the subtring *starts at 0* since it's always the first part of the string. If the substring is not part of the string index will return -1. TLDR we have an "off by one" error. We need to check that the return value is zero instead of any positive value. 1) Set your SIP server params so that only one SIP process should run, <server-params min_servers='1' min_spare_servers='0' max_spare_servers='0' max_servers='0' custom_tcp_keepalive='0' custom_tcp_keepalive_time='7200' custom_tcp_keepalive_intvl='75' /> 2) Set noissuescharge to $5 3) Create two SIP accounts 4) Set an account level override for noissuescharge to $500 5) Create a patron that owes $10 in fines 6) Run a patron information request on the "normal" SIP account for the patron, the patron flags should show the patron being not able to check out items 7) Run a patron information request of the "overridden" SIp account for the patron, the patron flags should show the patron being allowed to check out items 8) Run a second patron information request on the "normal" SIP account for the patron, the patron flags should show the patron being able to check out even though they should not be able to check out 9) Apply this patch 10) Restart all the things! 11) Repeast steps 6-8 12) The flags should be correct! Signed-off-by: Jake Deery <jake.deery@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38810 Jake Deery <jake.deery@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jake.deery@ptfs-europe.com --- Comment #7 from Jake Deery <jake.deery@ptfs-europe.com> --- Followed the plan, had a play, and couldn't break nowt. Signed off. Jake. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38810 Jake Deery <jake.deery@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38810 Martin Renvoize (ashimema) <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #176153|0 |1 is obsolete| | --- Comment #8 from Martin Renvoize (ashimema) <martin.renvoize@ptfs-europe.com> --- Created attachment 176198 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=176198&action=edit Bug 38810 - SIP account level system preference overrides not properly cleared between requests Account level syspref overrides in SIP will "leak" between SIP requests. Basically an account level system preference override will may be set by a given request, but those overrides will never be cleared for the life of that SIP process thus "contaminating" that process until it reaches end of life". This is because the code # Clear overrides from previous message handling first foreach my $key ( keys %ENV ) { delete $ENV{$key} if index($key, 'OVERRIDE_SYSPREF_') > 0; } is checking if the env key contains the substring OVERRIDE_SYSPREF_ at an index greater than 0. The problem is that for all overrides the subtring *starts at 0* since it's always the first part of the string. If the substring is not part of the string index will return -1. TLDR we have an "off by one" error. We need to check that the return value is zero instead of any positive value. 1) Set your SIP server params so that only one SIP process should run, <server-params min_servers='1' min_spare_servers='0' max_spare_servers='0' max_servers='0' custom_tcp_keepalive='0' custom_tcp_keepalive_time='7200' custom_tcp_keepalive_intvl='75' /> 2) Set noissuescharge to $5 3) Create two SIP accounts 4) Set an account level override for noissuescharge to $500 5) Create a patron that owes $10 in fines 6) Run a patron information request on the "normal" SIP account for the patron, the patron flags should show the patron being not able to check out items 7) Run a patron information request of the "overridden" SIp account for the patron, the patron flags should show the patron being allowed to check out items 8) Run a second patron information request on the "normal" SIP account for the patron, the patron flags should show the patron being able to check out even though they should not be able to check out 9) Apply this patch 10) Restart all the things! 11) Repeast steps 6-8 12) The flags should be correct! Signed-off-by: Jake Deery <jake.deery@ptfs-europe.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38810 Martin Renvoize (ashimema) <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@ptfs-europe | |.com Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38810 Martin Renvoize (ashimema) <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |martin.renvoize@ptfs-europe |y.org |.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38810 --- Comment #9 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Thanks yinz! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38810 --- Comment #10 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Amended bug description ... Bug 38810: ;) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38810 --- Comment #11 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Small change, big test plan :D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38810 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to main Version(s)| |25.05.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38810 --- Comment #12 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Pushed for 25.05! Well done everyone, thank you! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38810 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |release-notes-needed --- Comment #13 from David Nind <david@davidnind.com> --- I couldn't figure out what this means for libraries, so have added a release-notes-needed keyword. Please add a release not for this change that will make sense for library staff. Thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38810 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|25.05.00 |25.05.00,24.11.04 released in| | Status|Pushed to main |Pushed to stable -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38810 --- Comment #14 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Nice work everyone! Pushed to 24.11.x for 24.11.04 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38810 Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to stable |Needs documenting CC| |wainuiwitikapark@catalyst.n | |et.nz --- Comment #15 from Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> --- Not backporting to 22.11.x as it wasn't backported to 24.05.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38810 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs documenting |RESOLVED Resolution|--- |FIXED --- Comment #16 from David Nind <david@davidnind.com> --- Bug fix, no changes to the manual required. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org