[Bug 40911] New: SIP Patron->new() generates ORM warnings with undefined/empty patron_id
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40911 Bug ID: 40911 Summary: SIP Patron->new() generates ORM warnings with undefined/empty patron_id Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: SIP2 Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com QA Contact: testopia@bugs.koha-community.org Noticed in production, when C4::SIP::ILS::Patron->new is passed a $patron_id that is not defined or empty -or any processing makes it like that- (e.g. faulty plugins, malformed SIP requests) logs get flooded with DBIx::Class errors and Perl warnings when it should never reach the ORM with a query because there's nothing to search for. Similar to bug 40910 for Item->new(), the Patron constructor should validate input early and return gracefully without generating warnings for undefined/empty patron identifiers. Expected behavior: Silent return for invalid input, proper debug logging for troubleshooting Actual behavior: Warning spam in SIP server logs, potential DBIx::Class constraint errors This affects SIP server stability and makes log analysis difficult due to noise from invalid requests. -- 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=40911 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=40910 Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | CC| |jesse@bywatersolutions.com, | |kyle@bywatersolutions.com, | |lisette@bywatersolutions.co | |m, tomascohen@gmail.com Status|NEW |ASSIGNED -- 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=40911 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40911 --- Comment #1 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 187109 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=187109&action=edit Bug 40911: Regression tests -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40911 --- Comment #2 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 187110 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=187110&action=edit Bug 40911: Fix SIP Patron->new() warnings with undefined/empty patron_id This patch prevents warnings when C4::SIP::ILS::Patron->new() receives undefined, empty, or whitespace-only patron_id values that could occur from faulty plugins or malformed SIP requests. Changes: - Add early validation for undefined/empty patron_id before processing - Add validation for hashref keys to ensure they contain valid values - Add better debug logging for empty hashref scenarios - Prevent potential siplog formatting issues with hashref patron_id - No functional changes - behavior preserved for valid patron identifiers Test plan: 1. Apply the regression tests 2. Run: $ ktd --shell k$ prove t/db_dependent/SIP/Patron.t => FAIL: Tests fail! Warning validation expects no warnings but warnings occur 3. Apply this patch 4. Repeat step 2 => SUCCESS: Tests pass! No warnings generated for invalid input 5. Verify no warnings in SIP logs for malformed requests 6. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40911 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #3 from David Nind <david@davidnind.com> --- I don't get any test failures with just the regression patch: prove t/db_dependent/SIP/Patron.t t/db_dependent/SIP/Patron.t .. ok All tests successful. Files=1, Tests=10, 14 wallclock secs ( 0.02 usr 0.00 sys + 9.00 cusr 4.29 csys = 13.31 CPU) Result: PASS -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40911 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40911 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=41707 --- Comment #4 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- I have to say, this one has been annoying my coworkers quite a bit :) These fails seem to refer to pre-existing problems: [FAIL] C4/SIP/ILS/Patron.pm FAIL pod_coverage sub DESTROY has no pod coverage. sub _get_address has no pod coverage. sub AUTOLOAD has no pod coverage. sub _get_outstanding_holds has no pod coverage. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40911 Katrin Fischer <katrin.fischer@bsz-bw.de> 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=40911 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #187109|0 |1 is obsolete| | Attachment #187110|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40911 --- Comment #5 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 201125 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201125&action=edit Bug 40911: Regression tests Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40911 --- Comment #6 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 201126 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201126&action=edit Bug 40911: Fix SIP Patron->new() warnings with undefined/empty patron_id This patch prevents warnings when C4::SIP::ILS::Patron->new() receives undefined, empty, or whitespace-only patron_id values that could occur from faulty plugins or malformed SIP requests. Changes: - Add early validation for undefined/empty patron_id before processing - Add validation for hashref keys to ensure they contain valid values - Add better debug logging for empty hashref scenarios - Prevent potential siplog formatting issues with hashref patron_id - No functional changes - behavior preserved for valid patron identifiers Test plan: 1. Apply the regression tests 2. Run: $ ktd --shell k$ prove t/db_dependent/SIP/Patron.t => FAIL: Tests fail! Warning validation expects no warnings but warnings occur 3. Apply this patch 4. Repeat step 2 => SUCCESS: Tests pass! No warnings generated for invalid input 5. Verify no warnings in SIP logs for malformed requests 6. Sign off :-D Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40911 --- Comment #7 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- As an additional test I tried a patron information request with the SIP test tool. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org