[Bug 42739] New: OPAC ratings.js: Add CSRF-TOKEN header to fetch call
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42739 Bug ID: 42739 Summary: OPAC ratings.js: Add CSRF-TOKEN header to fetch call Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com QA Contact: testopia@bugs.koha-community.org CC: tomascohen@gmail.com ratings.js uses raw fetch() to POST to /api/v1/public/biblios/{id}/ratings without including the CSRF-TOKEN header. This will break once CSRF enforcement is enabled on the REST API (Bug 34451). The fix is to read the token from the csrf-token meta tag and include it in the fetch headers. Blocks Bug 34451. -- 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=42739 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |tomascohen@gmail.com |y.org | Blocks| |34451 Status|NEW |ASSIGNED -- 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=42739 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|tomascohen@gmail.com |testopia@bugs.koha-communit | |y.org Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.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=42739 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42739 --- Comment #1 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 199768 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199768&action=edit Bug 42739: Add CSRF-TOKEN header to OPAC ratings.js fetch call The ratings.js file uses raw fetch() to POST to the REST API without including the CSRF-TOKEN header. This will fail once CSRF enforcement is enabled on the REST API. Test plan: 1. Apply patch 2. Enable star ratings in OPAC (StarRatings syspref) 3. Log in to the OPAC 4. Rate a biblio using the star widget => SUCCESS: Rating is saved without errors 5. Sign off :-D Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42739 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=42739 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199768|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=42739 --- Comment #2 from David Nind <david@davidnind.com> --- Created attachment 199772 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199772&action=edit Bug 42739: Add CSRF-TOKEN header to OPAC ratings.js fetch call The ratings.js file uses raw fetch() to POST to the REST API without including the CSRF-TOKEN header. This will fail once CSRF enforcement is enabled on the REST API. Test plan: 1. Apply patch 2. Enable star ratings in OPAC (StarRatings syspref) 3. Log in to the OPAC 4. Rate a biblio using the star widget => SUCCESS: Rating is saved without errors 5. Sign off :-D Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42739 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=42739 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA QA Contact|testopia@bugs.koha-communit |jonathan.druart@gmail.com |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42739 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199772|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=42739 --- Comment #3 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 199801 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199801&action=edit Bug 42739: Add CSRF-TOKEN header to OPAC ratings.js fetch call The ratings.js file uses raw fetch() to POST to the REST API without including the CSRF-TOKEN header. This will fail once CSRF enforcement is enabled on the REST API. Test plan: 1. Apply patch 2. Enable star ratings in OPAC (StarRatings syspref) 3. Log in to the OPAC 4. Rate a biblio using the star widget => SUCCESS: Rating is saved without errors 5. Sign off :-D Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42739 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=42739 --- Comment #4 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=42739 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to main |Pushed to stable Version(s)|26.11.00 |26.11.00,26.05.02 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42739 --- Comment #5 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Nice work everyone! Pushed to 26.05.x for the upcoming 26.05.02 release. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org