[Bug 44285] New: "Cancel enrollment" broken when CSP is enabled
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44285 Bug ID: 44285 Summary: "Cancel enrollment" broken when CSP is enabled Initiative type: --- Sponsorship --- status: Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: OPAC Assignee: oleonard@myacpl.org Reporter: jonathan.druart@gmail.com QA Contact: testopia@bugs.koha-community.org Depends on: 38365 Target Milestone: --- Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38365 [Bug 38365] Add Content-Security-Policy HTTP header to HTML responses -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44285 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Assignee|oleonard@myacpl.org |jonathan.druart@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44285 --- Comment #1 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 212605 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212605&action=edit Bug 44285: Fix the clubs tab on the OPAC user page (CSP) Regression introduced by bug 38365 (Content-Security-Policy with nonces). The content of the clubs tab (clubs/clubs-tab.tt and clubs/enroll.tt) is loaded with an AJAX call and contains inline scripts. Those scripts carry the CSP nonce of the AJAX response, which does not match the nonce of the page the policy is enforced on, so the browser blocks them. As a result "Cancel enrollment" and "Enroll" do nothing, and the tables are not initialised. Move the JS to opac-user.tt, using delegated handlers on the panel and re-initialising the tables after each load. Also show an error when the request fails, instead of silently doing nothing. Test plan: 1. Enroll a patron in a club enrollable from the OPAC 2. Log in to the OPAC and go to opac-user.pl, "Clubs" tab 3. Click "Cancel enrollment" => Without this patch nothing happens => With this patch the enrollment is cancelled and the list reloaded 4. Click "Enroll" on a club, fill the form and click "Finish enrollment" => The enrollment is created => "Cancel" goes back to the list 5. Check the browser console for CSP errors Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44285 David Nind <david@davidnind.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=44285 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #212605|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=44285 --- Comment #2 from David Nind <david@davidnind.com> --- Created attachment 212635 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212635&action=edit Bug 44285: Fix the clubs tab on the OPAC user page (CSP) Regression introduced by bug 38365 (Content-Security-Policy with nonces). The content of the clubs tab (clubs/clubs-tab.tt and clubs/enroll.tt) is loaded with an AJAX call and contains inline scripts. Those scripts carry the CSP nonce of the AJAX response, which does not match the nonce of the page the policy is enforced on, so the browser blocks them. As a result "Cancel enrollment" and "Enroll" do nothing, and the tables are not initialised. Move the JS to opac-user.tt, using delegated handlers on the panel and re-initialising the tables after each load. Also show an error when the request fails, instead of silently doing nothing. Test plan: 1. Enroll a patron in a club enrollable from the OPAC 2. Log in to the OPAC and go to opac-user.pl, "Clubs" tab 3. Click "Cancel enrollment" => Without this patch nothing happens => With this patch the enrollment is cancelled and the list reloaded 4. Click "Enroll" on a club, fill the form and click "Finish enrollment" => The enrollment is created => "Cancel" goes back to the list 5. Check the browser console for CSP errors Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org