[Bug 42769] New: Add a SIP testing tool to the staff web interface
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 Bug ID: 42769 Summary: Add a SIP testing tool to the staff web interface Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: SIP2 Assignee: koha-bugs@lists.koha-community.org Reporter: kyle@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org Now that the SIP configuration is mostly in the staff interface, it would be very useful to have a tool not for testing SIP connectivity, but for checking the response value for the various custom template fields we have. I'm imagining a tab within the account editor ( for saved accounts ) where we can enter things like patron and item barcodes to test the generated response. It would be even better if we could wrap that in a transaction so it doesn't actually do anything, but I have the feeling that may prove infeasible. Such a testing tool would eliminate the need for someone to know the password for the SIP account in order to develop and test the various templates and options for that account. -- 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=42769 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=42769 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=42770 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 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=42769 --- Comment #1 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 202833 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=202833&action=edit Bug 42769: Add Koha::SIP2::MessageTester Now that the SIP configuration lives in the staff interface, there is no easy way to check what a SIP account will actually return for the various custom template fields without opening a telnet session and knowing the SIP account password. This patch adds Koha::SIP2::MessageTester, which builds the same server context the SIP server builds at login time ( minus the authentication ) from a saved Koha::SIP2::Account, hands a constructed request to the real message handlers, and returns the generated response broken into its fixed portion and its variable length fields. It can build the request from a message type and a patron/item barcode, or run a raw request string built elsewhere. The whole thing runs inside a transaction that is always rolled back, so even checkout and checkin messages don't actually do anything. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #2 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 202834 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=202834&action=edit Bug 42769: Add unit tests Patch from commit d3576c2 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #3 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 202835 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=202835&action=edit Bug 42769: Add REST API for the SIP message tester This patch adds a POST /sip2/accounts/{sip_account_id}/test_message endpoint that runs Koha::SIP2::MessageTester for a saved account and returns the generated request, the raw response, and the response broken into its fixed portion and its variable length fields. It accepts either a message type with a patron/item barcode, or a raw SIP2 request string to run as-is. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #4 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 202836 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=202836&action=edit Bug 42769: Add unit tests Patch from commit eebf286 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #5 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 202837 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=202837&action=edit Bug 42769: Add SIP2 message testing tool to the staff interface This patch adds a "Test SIP2 messages" tool to the SIP2 account editor in the staff interface. Right now there is no way to check what a SIP account will return for a given message without standing up a real SIP connection and knowing the account's SIP password. That makes it hard to confirm the custom template fields configured on an account ( the AE personal name, the custom patron/item fields, and so on ) actually render the values you expect. The tool is reachable from a saved account: open an account and click the new "Test SIP2 messages" button in the toolbar. You pick a message type ( patron status, patron information, item information, checkout or check-in ), fill in a patron barcode, item barcode and/or patron password, and the raw outgoing SIP request is built for you and shown in an editable box that updates as you change the form. You can also edit the raw request by hand. Running the test calls the new REST endpoint, which builds the account's server context ( without authenticating ) and hands the request to the real SIP message handlers. The whole thing runs in a transaction that is always rolled back, so even a checkout or check-in leaves the database untouched. The response is shown raw and broken down field by field with each field's name. The SIP field code to name map is moved out of the account editor into a shared composable so both the editor and the tester use it. Test Plan: 1) Apply this patch 2) yarn js:build 3) Restart all the things! 4) Go to Administration -> SIP2 -> Accounts and open an account whose institution implementation is "ILS" 5) Note the new "Test SIP2 messages" button in the toolbar, click it 6) Leave the message type on "Patron information", enter a valid patron barcode, note the raw request box updates as you type! 7) Click "Run test", note you get a response back broken down field by field, with the patron's name in the AE field and your custom patron fields rendered! 8) Switch the message type to "Item information", enter an item barcode, run the test, note the item fields come back! 9) Edit the raw request by hand, note the form fields stop updating it and a "Reset to the generated request" link appears! 10) Try "Checkout" and "Check-in" against a patron and item, note you get a response but the item is *not* actually checked out or in! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 Andrew Fuerste-Henry <andrew@bywatersolutions.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=42769 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #202833|0 |1 is obsolete| | Attachment #202834|0 |1 is obsolete| | Attachment #202835|0 |1 is obsolete| | Attachment #202836|0 |1 is obsolete| | Attachment #202837|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=42769 --- Comment #6 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 207250 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207250&action=edit Bug 42769: Add Koha::SIP2::MessageTester Now that the SIP configuration lives in the staff interface, there is no easy way to check what a SIP account will actually return for the various custom template fields without opening a telnet session and knowing the SIP account password. This patch adds Koha::SIP2::MessageTester, which builds the same server context the SIP server builds at login time ( minus the authentication ) from a saved Koha::SIP2::Account, hands a constructed request to the real message handlers, and returns the generated response broken into its fixed portion and its variable length fields. It can build the request from a message type and a patron/item barcode, or run a raw request string built elsewhere. The whole thing runs inside a transaction that is always rolled back, so even checkout and checkin messages don't actually do anything. Signed-off-by: Michelle Spinney <mspinney@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #7 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 207251 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207251&action=edit Bug 42769: Add unit tests Signed-off-by: Michelle Spinney <mspinney@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #8 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 207252 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207252&action=edit Bug 42769: Add REST API for the SIP message tester This patch adds a POST /sip2/accounts/{sip_account_id}/test_message endpoint that runs Koha::SIP2::MessageTester for a saved account and returns the generated request, the raw response, and the response broken into its fixed portion and its variable length fields. It accepts either a message type with a patron/item barcode, or a raw SIP2 request string to run as-is. Signed-off-by: Michelle Spinney <mspinney@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #9 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 207253 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207253&action=edit Bug 42769: Add unit tests Signed-off-by: Michelle Spinney <mspinney@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #10 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 207254 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207254&action=edit Bug 42769: Add SIP2 message testing tool to the staff interface This patch adds a "Test SIP2 messages" tool to the SIP2 account editor in the staff interface. Right now there is no way to check what a SIP account will return for a given message without standing up a real SIP connection and knowing the account's SIP password. That makes it hard to confirm the custom template fields configured on an account ( the AE personal name, the custom patron/item fields, and so on ) actually render the values you expect. The tool is reachable from a saved account: open an account and click the new "Test SIP2 messages" button in the toolbar. You pick a message type ( patron status, patron information, item information, checkout or check-in ), fill in a patron barcode, item barcode and/or patron password, and the raw outgoing SIP request is built for you and shown in an editable box that updates as you change the form. You can also edit the raw request by hand. Running the test calls the new REST endpoint, which builds the account's server context ( without authenticating ) and hands the request to the real SIP message handlers. The whole thing runs in a transaction that is always rolled back, so even a checkout or check-in leaves the database untouched. The response is shown raw and broken down field by field with each field's name. The SIP field code to name map is moved out of the account editor into a shared composable so both the editor and the tester use it. Test Plan: 1) Apply this patch 2) yarn js:build 3) Restart all the things! 4) Go to Administration -> SIP2 -> Accounts and open an account whose institution implementation is "ILS" 5) Note the new "Test SIP2 messages" button in the toolbar, click it 6) Leave the message type on "Patron information", enter a valid patron barcode, note the raw request box updates as you type! 7) Click "Run test", note you get a response back broken down field by field, with the patron's name in the AE field and your custom patron fields rendered! 8) Switch the message type to "Item information", enter an item barcode, run the test, note the item fields come back! 9) Edit the raw request by hand, note the form fields stop updating it and a "Reset to the generated request" link appears! 10) Try "Checkout" and "Check-in" against a patron and item, note you get a response but the item is *not* actually checked out or in! Signed-off-by: Michelle Spinney <mspinney@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |37893 CC| |andrew@bywatersolutions.com Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37893 [Bug 37893] Migrate some SIP configuration into the staff interface -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |26.11 Blocks| |37248 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37248 [Bug 37248] [Omnibus] Power to the user -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@openfifth.c | |o.uk --- Comment #11 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- This is awesome.. I'll attempt to QA it later this week.. might mention it at KohaCon as a next step for making SIP config more accessible too -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |martin.renvoize@openfifth.c |y.org |o.uk -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au --- Comment #12 from David Cook <dcook@prosentient.com.au> --- Ohhh this could be very handy, and for that exact reason. I had someone setting up an account in the web UI the other day with some customizations, and they were having some difficulty testing. (Like they had to do an end to end test with their kiosk I think which is obviously quite suboptimal.) After looking through the code, I think I like this even more than I already did from reading the Description. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA --- Comment #13 from David Cook <dcook@prosentient.com.au> --- That said, changing this to "Failed QA". It looks like this change would allow people to bypass cross-branch restrictions (ie IndependentBranches/Library Groups). For instance, responses should be limited by patron_id and item_id to only those patrons and items accessible to the logged in user. Otherwise, the REST API endpoint could easily be used in a user enumeration attack to show information for all users across privacy and permission boundaries (as this endpoint only requires the sip2 permission). I think the API endpoint will need some additional permissions as well regarding patron information. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #14 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Nice catch David :) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 nhansen@nekls.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nhansen@nekls.org -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #207250|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=42769 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #207251|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=42769 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #207252|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=42769 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #207253|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=42769 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #207254|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=42769 --- Comment #15 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 207986 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207986&action=edit Bug 42769: Add Koha::SIP2::MessageTester Now that the SIP configuration lives in the staff interface, there is no easy way to check what a SIP account will actually return for the various custom template fields without opening a telnet session and knowing the SIP account password. This patch adds Koha::SIP2::MessageTester, which builds the same server context the SIP server builds at login time ( minus the authentication ) from a saved Koha::SIP2::Account, hands a constructed request to the real message handlers, and returns the generated response broken into its fixed portion and its variable length fields. It can build the request from a message type and a patron/item barcode, or run a raw request string built elsewhere. The whole thing runs inside a transaction that is always rolled back, so even checkout and checkin messages don't actually do anything. Signed-off-by: Michelle Spinney <mspinney@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #16 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 207987 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207987&action=edit Bug 42769: Add unit tests Signed-off-by: Michelle Spinney <mspinney@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #17 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 207988 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207988&action=edit Bug 42769: Add REST API for the SIP message tester This patch adds a POST /sip2/accounts/{sip_account_id}/test_message endpoint that runs Koha::SIP2::MessageTester for a saved account and returns the generated request, the raw response, and the response broken into its fixed portion and its variable length fields. It accepts either a message type with a patron/item barcode, or a raw SIP2 request string to run as-is. Signed-off-by: Michelle Spinney <mspinney@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #18 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 207989 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207989&action=edit Bug 42769: Add unit tests Signed-off-by: Michelle Spinney <mspinney@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #19 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 207990 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207990&action=edit Bug 42769: Add SIP2 message testing tool to the staff interface This patch adds a "Test SIP2 messages" tool to the SIP2 account editor in the staff interface. Right now there is no way to check what a SIP account will return for a given message without standing up a real SIP connection and knowing the account's SIP password. That makes it hard to confirm the custom template fields configured on an account ( the AE personal name, the custom patron/item fields, and so on ) actually render the values you expect. The tool is reachable from a saved account: open an account and click the new "Test SIP2 messages" button in the toolbar. You pick a message type ( patron status, patron information, item information, checkout or check-in ), fill in a patron barcode, item barcode and/or patron password, and the raw outgoing SIP request is built for you and shown in an editable box that updates as you change the form. You can also edit the raw request by hand. Running the test calls the new REST endpoint, which builds the account's server context ( without authenticating ) and hands the request to the real SIP message handlers. The whole thing runs in a transaction that is always rolled back, so even a checkout or check-in leaves the database untouched. The response is shown raw and broken down field by field with each field's name. The SIP field code to name map is moved out of the account editor into a shared composable so both the editor and the tester use it. Test Plan: 1) Apply this patch 2) yarn js:build 3) Restart all the things! 4) Go to Administration -> SIP2 -> Accounts and open an account whose institution implementation is "ILS" 5) Note the new "Test SIP2 messages" button in the toolbar, click it 6) Leave the message type on "Patron information", enter a valid patron barcode, note the raw request box updates as you type! 7) Click "Run test", note you get a response back broken down field by field, with the patron's name in the AE field and your custom patron fields rendered! 8) Switch the message type to "Item information", enter an item barcode, run the test, note the item fields come back! 9) Edit the raw request by hand, note the form fields stop updating it and a "Reset to the generated request" link appears! 10) Try "Checkout" and "Check-in" against a patron and item, note you get a response but the item is *not* actually checked out or in! Signed-off-by: Michelle Spinney <mspinney@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #20 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 207991 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207991&action=edit Bug 42769: (QA follow-up) SIP message tester should respect patron and item library restrictions This patch: * Requires borrowers: list_borrowers in addition to sip2 for the test_message endpoint * Refuses a patron the logged in user can't see ( Koha::Patrons->search_limited ) with a 404, the same as GET /patrons/{patron_id} * Refuses an item from another library with a 403 when IndependentBranches is enabled, unless the user is a superlibrarian * Parses the request the same way the SIP handler does before checking it, so a hand edited raw request gets the same checks * Refuses a raw request for any message the tester doesn't support ( login, hold, fee paid, etc ) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #21 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 207992 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207992&action=edit Bug 42769: (QA follow-up) Split the sip2 permission into manage_sip2 and test_sip2_messages This patch: * Adds the subpermissions sip2.manage_sip2 and sip2.test_sip2_messages, librarians with the whole sip2 module keep both * Requires manage_sip2 for the SIP2 page and all the existing SIP2 endpoints * Requires test_sip2_messages ( plus list_borrowers ) for the test_message endpoint * Only shows the "Test SIP2 messages" button to librarians who can use it -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #22 from David Cook <dcook@prosentient.com.au> --- Great follow-ups, folk. Much appreciated! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #23 from David Cook <dcook@prosentient.com.au> --- (In reply to David Cook from comment #22)
Great follow-ups, folk. Much appreciated!
At some point, we need to iron out IndependentBranches/LibraryGroups systematically across Koha but that's out of scope here. Thank you for fixing the cross-branch restrictions though. It's super helpful. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #24 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- (In reply to David Cook from comment #23)
(In reply to David Cook from comment #22)
Great follow-ups, folk. Much appreciated!
At some point, we need to iron out IndependentBranches/LibraryGroups systematically across Koha but that's out of scope here. Thank you for fixing the cross-branch restrictions though. It's super helpful.
David, would you be able to QA this since you've already looked at it thoroughly? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #25 from David Cook <dcook@prosentient.com.au> --- (In reply to Andrew Fuerste-Henry from comment #24)
David, would you be able to QA this since you've already looked at it thoroughly?
That is a very logical proposition. I can keep it on my list, but it's going to be low on my priorities unfortunately :(. I'm slammed with non-Koha work, so my focus is pretty much purely on Koha Security / reviewing potential security issues. I'll try to revisit it next week. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 Marion Durand <marion.durand@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |marion.durand@biblibre.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |43848 --- Comment #26 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208462 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208462&action=edit Bug 42769: (QA follow-up) Run the SIP2 message tester in isolation and clean up after it Running the real SIP handlers has effects that rolling back the database transaction does not undo, and the way the state was restored could hide a failure: - The state was restored, and the transaction rolled back, in a Try::Tiny finally block. An exception thrown there is swallowed, so a rollback that failed could leave the changes of a checkout or checkin in place and still answer 200. Restore the state with plain statements and roll back in a try of its own, so a failed rollback is thrown. The transaction is also begun before any global is touched. - Enqueuing a background job publishes it to the message broker straight away, a rollback doesn't recall it and the workers hear about jobs that never existed. Publishing is suppressed while the handler runs. - update_lastseen stores the date, which is rolled back, and remembers in the cache that it did so for the day, which is not, so a real connection afterwards would skip the update. It is turned off while the handler runs. - The handlers ran with the session of the staff member running the test. They now run with the session a real SIP login has, the patron the account logs in as at the institution's library, which the circulation rules read. The test fails with ObjectNotFound if that patron doesn't exist, as a login would. The access check still runs first, with the session of the staff member. - Every test is logged, outside the transaction, with the user, the account and the message code ( no patron or item identifiers ). Rolling back also means a failed patron password check leaves no trace. The line goes to the api log without the plack- prefix that Koha::Logger adds under Plack, as the default configuration only logs plack-api from WARN and an INFO line would be dropped for every request the web server handles. - The POD and the API description no longer say that nothing is changed: plugin hooks still run and the password lockout does not apply. To test: 1) prove t/db_dependent/Koha/SIP2/MessageTester.t 2) prove t/db_dependent/api/v1/sip2_account_test_message.t Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43848 [Bug 43848] Share SIP request parsing and building between server, emulator and tester -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #27 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208463 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208463&action=edit Bug 42769: (QA follow-up) Report handler failures and bad requests correctly from the SIP2 message tester The controller maps NoPermission to a 403, Patron::NotFound to a 404 and BadParameter to a 400, which is right for the checks on the request but wrong for anything thrown from inside a SIP handler: a handler that fails with one of those would tell the user that they were refused, that their patron doesn't exist or that they sent bad input. Errors from a handler are now wrapped in a Koha::Exception, so they come back as a 500, and only the refusals the tester makes itself keep their meaning. Also: - An account with no patron to log in as, and an institution that is not in the configuration, are ObjectNotFound and answer with a 404 and a message. - An implementation that cannot be loaded says so, instead of failing with "Can't locate object method". - A barcode or password containing the field delimiter is refused with a 400. It would add fields to the request, so the request that was run differed from the one the form described. - A patron password of 0 is no longer dropped from the request. To test: 1) prove t/db_dependent/Koha/SIP2/MessageTester.t 2) prove t/db_dependent/api/v1/sip2_account_test_message.t Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #28 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208464 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208464&action=edit Bug 42769: (QA follow-up) Return the SIP2 test response as characters The SIP server writes a response in the encoding of the account, and write_msg leaves the encoded octets in $last_response. The tester returned that as it was, so the JSON carried every octet as a character and a name with an accent or a symbol came out as mojibake in the staff interface. Decode the response with the encoding of the account, as a terminal reads it. To test: 1) prove t/db_dependent/Koha/SIP2/MessageTester.t Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #29 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208465 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208465&action=edit Bug 42769: (QA follow-up) Fix error handling and accessibility in the SIP2 account tester - Show the error when the account cannot be loaded, and a loading message. The error was rendered inside the block that needs the account, so a failed load left a blank page. - Check that the response has the expected shape before rendering it, and unwrap the "Error: " prefix the http client adds to messages. - Make the "Test SIP2 messages" toolbar button a route link, so it is focusable, has an href and can be opened in a new tab. It is still only shown to librarians who may test messages. - Refuse a "|" in the patron barcode, item barcode and password and disable the Run button: the delimiter would add fields to the generated request. - Build a fresh timestamp when resetting to the generated request. - Mask the patron password field, announce errors and results to assistive technology ( role="alert", aria-live ). - Use the imported $__ in sip2-fields.js and drop the unused getSIPFields and router leftovers from SIP2AccountResource.vue. - Reword the page text: plugin hooks still run and tests are logged. - Add a Cypress spec for the tester. To test: 1) yarn js:build 2) Run t/cypress/integration/SIP2/AccountTester.ts and t/cypress/integration/SIP2/Accounts.ts Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #30 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208466 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208466&action=edit Bug 42769: (QA follow-up) Don't warn on a short field in a SIP2 test response _parse_response took the value of a field with substr( $chunk, 2 ), which warns "substr outside of string" for a chunk of one or two characters, such as the last piece of a response that doesn't end with a delimiter. Such a chunk is a field without a value. To test: 1) prove t/db_dependent/Koha/SIP2/MessageTester.t Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #31 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208467 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208467&action=edit Bug 42769: (QA follow-up) Never check a real patron password in the SIP2 message tester The tester passed the patron password it was given to the real password check and showed in the response whether it matched. That makes it a way to guess the password of any patron the user can see: there is no lockout, as the failed attempts are rolled back with everything else, and the log doesn't say what the outcome was. It also meant staff had to know, type and send the real password of a patron, which then sat in the raw request box and in the API body. The password is no longer checked at all. A request says what the outcome should be instead: - GOOD makes the password count as the patron's, anything else as wrong. The check is replaced for the time the handler runs, so the handler still builds the real "valid" and "invalid" responses. - A password that is neither GOOD nor BAD is refused with a 400, whether it comes from the form or was typed into a raw request, so the raw request box isn't a way round it. - patron_password in the API takes GOOD or BAD only. - In the staff interface the password field is a choice of "Not sent", "Valid password" and "Invalid password", and the request shows ADGOOD or ADBAD. The POD and the API description say so, and no longer need to warn that the lockout does not apply. To test: 1) prove t/db_dependent/Koha/SIP2/MessageTester.t 2) prove t/db_dependent/api/v1/sip2_account_test_message.t 3) yarn js:build, then run t/cypress/integration/SIP2/AccountTester.ts Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #32 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208468 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208468&action=edit Bug 42769: (QA follow-up) Line up the labels and the content in the SIP2 account tester Koha's rows fieldsets float each label to the left in a narrow, right aligned box and expect a short input next to it. The raw request, the raw response and the fixed fields are as wide as the form, so their labels sat at a different indent from the textarea or the pre under them, and the hint of the password wrapped back under the label column instead of staying with the select. - Put the label of those three fields above them, left aligned and flush with the content. - Keep the hint of the password with the select it explains, under it and lined up with it. - Check in the Cypress spec that each label starts where its content starts and is as wide as it, and that the hint is under its select. To test: 1) yarn js:build 2) Open a test of an account, run a message and look at the Request message and the Response 3) Run t/cypress/integration/SIP2/AccountTester.ts Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #33 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208469 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208469&action=edit Bug 42769: (QA follow-up) Let the SIP2 tester ask for a detail in a patron information request A patron information request asks for one list of items in the response with the summary field: the holds, the overdue items, the charged items, the fines, the recalls or the unavailable holds. The tester always sent ten spaces, so none of the lists was ever in the response. That left out the template of the account that formats the fines (AV), one of the templates this tool is meant to check, and it could only be reached by editing the raw request and knowing which of the ten places stands for the fines. - Add a "Detail" choice to the patron information message: None, which is what was sent before, or one of the six lists. The server reads the first Y only, so one choice is the right shape, and the request gets a Y in the place of the one that is picked. - Add the same choice to the API as the optional summary, one of hold_items, overdue_items, charged_items, fine_items, recall_items or unavailable_holds, and to Koha::SIP2::MessageTester. - Test that the fines, formatted with the template of the account, are in the response with the fine items and not without them, where the Y goes for each of the six, and that the choice in the form builds the request. To test: 1) prove t/db_dependent/Koha/SIP2/MessageTester.t 2) prove t/db_dependent/api/v1/sip2_account_test_message.t 3) yarn js:build, then run t/cypress/integration/SIP2/AccountTester.ts Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- 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=42769 Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pedro.amorim@openfifth.co.u | |k Status|Passed QA |Patch doesn't apply -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Patch doesn't apply |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #207986|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=42769 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #207987|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=42769 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #207988|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=42769 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #207989|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=42769 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #207990|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=42769 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #207991|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=42769 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #207992|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=42769 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #208462|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=42769 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #208463|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=42769 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #208464|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=42769 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #208465|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=42769 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #208466|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=42769 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #208467|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=42769 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #208468|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=42769 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #208469|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=42769 --- Comment #34 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 210590 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210590&action=edit Bug 42769: Add Koha::SIP2::MessageTester Now that the SIP configuration lives in the staff interface, there is no easy way to check what a SIP account will actually return for the various custom template fields without opening a telnet session and knowing the SIP account password. This patch adds Koha::SIP2::MessageTester, which builds the same server context the SIP server builds at login time ( minus the authentication ) from a saved Koha::SIP2::Account, hands a constructed request to the real message handlers, and returns the generated response broken into its fixed portion and its variable length fields. It can build the request from a message type and a patron/item barcode, or run a raw request string built elsewhere. The whole thing runs inside a transaction that is always rolled back, so even checkout and checkin messages don't actually do anything. Signed-off-by: Michelle Spinney <mspinney@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #35 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 210591 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210591&action=edit Bug 42769: Add unit tests Signed-off-by: Michelle Spinney <mspinney@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #36 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 210592 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210592&action=edit Bug 42769: Add REST API for the SIP message tester This patch adds a POST /sip2/accounts/{sip_account_id}/test_message endpoint that runs Koha::SIP2::MessageTester for a saved account and returns the generated request, the raw response, and the response broken into its fixed portion and its variable length fields. It accepts either a message type with a patron/item barcode, or a raw SIP2 request string to run as-is. Signed-off-by: Michelle Spinney <mspinney@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #37 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 210593 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210593&action=edit Bug 42769: Add unit tests Signed-off-by: Michelle Spinney <mspinney@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #38 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 210594 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210594&action=edit Bug 42769: Add SIP2 message testing tool to the staff interface This patch adds a "Test SIP2 messages" tool to the SIP2 account editor in the staff interface. Right now there is no way to check what a SIP account will return for a given message without standing up a real SIP connection and knowing the account's SIP password. That makes it hard to confirm the custom template fields configured on an account ( the AE personal name, the custom patron/item fields, and so on ) actually render the values you expect. The tool is reachable from a saved account: open an account and click the new "Test SIP2 messages" button in the toolbar. You pick a message type ( patron status, patron information, item information, checkout or check-in ), fill in a patron barcode, item barcode and/or patron password, and the raw outgoing SIP request is built for you and shown in an editable box that updates as you change the form. You can also edit the raw request by hand. Running the test calls the new REST endpoint, which builds the account's server context ( without authenticating ) and hands the request to the real SIP message handlers. The whole thing runs in a transaction that is always rolled back, so even a checkout or check-in leaves the database untouched. The response is shown raw and broken down field by field with each field's name. The SIP field code to name map is moved out of the account editor into a shared composable so both the editor and the tester use it. Test Plan: 1) Apply this patch 2) yarn js:build 3) Restart all the things! 4) Go to Administration -> SIP2 -> Accounts and open an account whose institution implementation is "ILS" 5) Note the new "Test SIP2 messages" button in the toolbar, click it 6) Leave the message type on "Patron information", enter a valid patron barcode, note the raw request box updates as you type! 7) Click "Run test", note you get a response back broken down field by field, with the patron's name in the AE field and your custom patron fields rendered! 8) Switch the message type to "Item information", enter an item barcode, run the test, note the item fields come back! 9) Edit the raw request by hand, note the form fields stop updating it and a "Reset to the generated request" link appears! 10) Try "Checkout" and "Check-in" against a patron and item, note you get a response but the item is *not* actually checked out or in! Signed-off-by: Michelle Spinney <mspinney@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #39 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 210595 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210595&action=edit Bug 42769: (QA follow-up) SIP message tester should respect patron and item library restrictions This patch: * Requires borrowers: list_borrowers in addition to sip2 for the test_message endpoint * Refuses a patron the logged in user can't see ( Koha::Patrons->search_limited ) with a 404, the same as GET /patrons/{patron_id} * Refuses an item from another library with a 403 when IndependentBranches is enabled, unless the user is a superlibrarian * Parses the request the same way the SIP handler does before checking it, so a hand edited raw request gets the same checks * Refuses a raw request for any message the tester doesn't support ( login, hold, fee paid, etc ) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #40 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 210596 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210596&action=edit Bug 42769: (QA follow-up) Split the sip2 permission into manage_sip2 and test_sip2_messages This patch: * Adds the subpermissions sip2.manage_sip2 and sip2.test_sip2_messages, librarians with the whole sip2 module keep both * Requires manage_sip2 for the SIP2 page and all the existing SIP2 endpoints * Requires test_sip2_messages ( plus list_borrowers ) for the test_message endpoint * Only shows the "Test SIP2 messages" button to librarians who can use it -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #41 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 210597 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210597&action=edit Bug 42769: (QA follow-up) Run the SIP2 message tester in isolation and clean up after it Running the real SIP handlers has effects that rolling back the database transaction does not undo, and the way the state was restored could hide a failure: - The state was restored, and the transaction rolled back, in a Try::Tiny finally block. An exception thrown there is swallowed, so a rollback that failed could leave the changes of a checkout or checkin in place and still answer 200. Restore the state with plain statements and roll back in a try of its own, so a failed rollback is thrown. The transaction is also begun before any global is touched. - Enqueuing a background job publishes it to the message broker straight away, a rollback doesn't recall it and the workers hear about jobs that never existed. Publishing is suppressed while the handler runs. - update_lastseen stores the date, which is rolled back, and remembers in the cache that it did so for the day, which is not, so a real connection afterwards would skip the update. It is turned off while the handler runs. - The handlers ran with the session of the staff member running the test. They now run with the session a real SIP login has, the patron the account logs in as at the institution's library, which the circulation rules read. The test fails with ObjectNotFound if that patron doesn't exist, as a login would. The access check still runs first, with the session of the staff member. - Every test is logged, outside the transaction, with the user, the account and the message code ( no patron or item identifiers ). Rolling back also means a failed patron password check leaves no trace. The line goes to the api log without the plack- prefix that Koha::Logger adds under Plack, as the default configuration only logs plack-api from WARN and an INFO line would be dropped for every request the web server handles. - The POD and the API description no longer say that nothing is changed: plugin hooks still run and the password lockout does not apply. To test: 1) prove t/db_dependent/Koha/SIP2/MessageTester.t 2) prove t/db_dependent/api/v1/sip2_account_test_message.t Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #42 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 210598 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210598&action=edit Bug 42769: (QA follow-up) Report handler failures and bad requests correctly from the SIP2 message tester The controller maps NoPermission to a 403, Patron::NotFound to a 404 and BadParameter to a 400, which is right for the checks on the request but wrong for anything thrown from inside a SIP handler: a handler that fails with one of those would tell the user that they were refused, that their patron doesn't exist or that they sent bad input. Errors from a handler are now wrapped in a Koha::Exception, so they come back as a 500, and only the refusals the tester makes itself keep their meaning. Also: - An account with no patron to log in as, and an institution that is not in the configuration, are ObjectNotFound and answer with a 404 and a message. - An implementation that cannot be loaded says so, instead of failing with "Can't locate object method". - A barcode or password containing the field delimiter is refused with a 400. It would add fields to the request, so the request that was run differed from the one the form described. - A patron password of 0 is no longer dropped from the request. To test: 1) prove t/db_dependent/Koha/SIP2/MessageTester.t 2) prove t/db_dependent/api/v1/sip2_account_test_message.t Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #43 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 210599 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210599&action=edit Bug 42769: (QA follow-up) Return the SIP2 test response as characters The SIP server writes a response in the encoding of the account, and write_msg leaves the encoded octets in $last_response. The tester returned that as it was, so the JSON carried every octet as a character and a name with an accent or a symbol came out as mojibake in the staff interface. Decode the response with the encoding of the account, as a terminal reads it. To test: 1) prove t/db_dependent/Koha/SIP2/MessageTester.t Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #44 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 210600 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210600&action=edit Bug 42769: (QA follow-up) Fix error handling and accessibility in the SIP2 account tester - Show the error when the account cannot be loaded, and a loading message. The error was rendered inside the block that needs the account, so a failed load left a blank page. - Check that the response has the expected shape before rendering it, and unwrap the "Error: " prefix the http client adds to messages. - Make the "Test SIP2 messages" toolbar button a route link, so it is focusable, has an href and can be opened in a new tab. It is still only shown to librarians who may test messages. - Refuse a "|" in the patron barcode, item barcode and password and disable the Run button: the delimiter would add fields to the generated request. - Build a fresh timestamp when resetting to the generated request. - Mask the patron password field, announce errors and results to assistive technology ( role="alert", aria-live ). - Use the imported $__ in sip2-fields.js and drop the unused getSIPFields and router leftovers from SIP2AccountResource.vue. - Reword the page text: plugin hooks still run and tests are logged. - Add a Cypress spec for the tester. To test: 1) yarn js:build 2) Run t/cypress/integration/SIP2/AccountTester.ts and t/cypress/integration/SIP2/Accounts.ts Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #45 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 210601 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210601&action=edit Bug 42769: (QA follow-up) Don't warn on a short field in a SIP2 test response _parse_response took the value of a field with substr( $chunk, 2 ), which warns "substr outside of string" for a chunk of one or two characters, such as the last piece of a response that doesn't end with a delimiter. Such a chunk is a field without a value. To test: 1) prove t/db_dependent/Koha/SIP2/MessageTester.t Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #46 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 210602 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210602&action=edit Bug 42769: (QA follow-up) Never check a real patron password in the SIP2 message tester The tester passed the patron password it was given to the real password check and showed in the response whether it matched. That makes it a way to guess the password of any patron the user can see: there is no lockout, as the failed attempts are rolled back with everything else, and the log doesn't say what the outcome was. It also meant staff had to know, type and send the real password of a patron, which then sat in the raw request box and in the API body. The password is no longer checked at all. A request says what the outcome should be instead: - GOOD makes the password count as the patron's, anything else as wrong. The check is replaced for the time the handler runs, so the handler still builds the real "valid" and "invalid" responses. - A password that is neither GOOD nor BAD is refused with a 400, whether it comes from the form or was typed into a raw request, so the raw request box isn't a way round it. - patron_password in the API takes GOOD or BAD only. - In the staff interface the password field is a choice of "Not sent", "Valid password" and "Invalid password", and the request shows ADGOOD or ADBAD. The POD and the API description say so, and no longer need to warn that the lockout does not apply. To test: 1) prove t/db_dependent/Koha/SIP2/MessageTester.t 2) prove t/db_dependent/api/v1/sip2_account_test_message.t 3) yarn js:build, then run t/cypress/integration/SIP2/AccountTester.ts Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #47 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 210603 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210603&action=edit Bug 42769: (QA follow-up) Line up the labels and the content in the SIP2 account tester Koha's rows fieldsets float each label to the left in a narrow, right aligned box and expect a short input next to it. The raw request, the raw response and the fixed fields are as wide as the form, so their labels sat at a different indent from the textarea or the pre under them, and the hint of the password wrapped back under the label column instead of staying with the select. - Put the label of those three fields above them, left aligned and flush with the content. - Keep the hint of the password with the select it explains, under it and lined up with it. - Check in the Cypress spec that each label starts where its content starts and is as wide as it, and that the hint is under its select. To test: 1) yarn js:build 2) Open a test of an account, run a message and look at the Request message and the Response 3) Run t/cypress/integration/SIP2/AccountTester.ts Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #48 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 210604 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210604&action=edit Bug 42769: (QA follow-up) Let the SIP2 tester ask for a detail in a patron information request A patron information request asks for one list of items in the response with the summary field: the holds, the overdue items, the charged items, the fines, the recalls or the unavailable holds. The tester always sent ten spaces, so none of the lists was ever in the response. That left out the template of the account that formats the fines (AV), one of the templates this tool is meant to check, and it could only be reached by editing the raw request and knowing which of the ten places stands for the fines. - Add a "Detail" choice to the patron information message: None, which is what was sent before, or one of the six lists. The server reads the first Y only, so one choice is the right shape, and the request gets a Y in the place of the one that is picked. - Add the same choice to the API as the optional summary, one of hold_items, overdue_items, charged_items, fine_items, recall_items or unavailable_holds, and to Koha::SIP2::MessageTester. - Test that the fines, formatted with the template of the account, are in the response with the fine items and not without them, where the Y goes for each of the six, and that the choice in the form builds the request. To test: 1) prove t/db_dependent/Koha/SIP2/MessageTester.t 2) prove t/db_dependent/api/v1/sip2_account_test_message.t 3) yarn js:build, then run t/cypress/integration/SIP2/AccountTester.ts Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #49 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 210605 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210605&action=edit Bug 42769: (QA follow-up) Replace UNIVERSAL::require with Module::Load::Conditional Bug 42860 dropped UNIVERSAL::require from the SIP server and from Koha's dependencies, so the tester can't rely on it to load the ILS implementation any more. It now loads the module with can_load, the same as C4::SIP::Sip::MsgType does. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |26.11.00 released in| | Status|Passed QA |Pushed to main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #50 from Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> --- Thanks everyone! Pushed to main for 26.11! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #51 from Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> --- This is awesome. My only tiny nit is that SIP2AccountTester renders its whole form by hand. At the very least, the simple fields (message type, barcodes, password, detail) should use FormElement instead. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Sponsorship status|--- |Sponsored Comma delimited| |ByWater Solutions list of Sponsors| | --- Comment #52 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- (In reply to Pedro Amorim (ammopt) from comment #51)
This is awesome. My only tiny nit is that SIP2AccountTester renders its whole form by hand. At the very least, the simple fields (message type, barcodes, password, detail) should use FormElement instead.
-- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #53 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 210671 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210671&action=edit Bug 42769: (QA follow-up) Use FormElement for the simple fields of the SIP2 account tester * Message type, barcodes, patron password and details are now FormElement fields * The tester's selects get a minimum width, the 30% the SIP2 module gives a select is too narrow in the half width column of the tester -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #54 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- (In reply to Pedro Amorim (ammopt) from comment #51)
This is awesome. My only tiny nit is that SIP2AccountTester renders its whole form by hand. At the very least, the simple fields (message type, barcodes, password, detail) should use FormElement instead.
Pedro, is "Bug 42769: (QA follow-up) Use FormElement for the simple fields of the SIP2 account tester" what you are looking for? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 --- Comment #55 from Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> --- (In reply to Kyle M Hall (khall) from comment #54)
Pedro, is "Bug 42769: (QA follow-up) Use FormElement for the simple fields of the SIP2 account tester" what you are looking for?
Yes. Perfect. Thank you! Follow-up pushed. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42769 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com Status|Pushed to main |Needs documenting --- Comment #56 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- No 26.05.x backport -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org