Bug 37074

Summary: Comment approval and un-approval should be CSRF-protected
Product: Koha Reporter: Owen Leonard <oleonard>
Component: OPACAssignee: Owen Leonard <oleonard>
Status: Needs documenting --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: dcook, didier.gautheron, fridolin.somers, jonathan.druart, laurent.ducos, lisette, lucas, m.de.rooy, martin.renvoize, nick, philippe.blouin, tomascohen, wainuiwitikapark
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.11.00,24.05.02
Circulation function:
Bug Depends on:    
Bug Blocks: 2486    
Attachments: Bug 37074: Comment approval and un-approval should be CSRF-protected
Bug 37074: Comment approval and un-approval should be CSRF-protected
Bug 37074: Comment approval and un-approval should be CSRF-protected
Bug 37074: Do no pass biblionumber

Description Owen Leonard 2024-06-12 12:32:46 UTC
In Tools -> Comments, the process of approving and un-approving comments is a GET operation. These should be POST'ed with a CSRF token.
Comment 1 Owen Leonard 2024-06-12 18:25:30 UTC
Created attachment 167671 [details] [review]
Bug 37074: Comment approval and un-approval should be CSRF-protected

This patch converts the "Approve" and "Unapprove" controls in the staff
client's comment moderation page so that the operations are POST instead
of GET.

To test, apply the patch and restart services.

- If necessary, enable OPACComments and submit a few comments on a few
  titles in the OPAC
- Go to Tools -> Comments
- Test the process of approving, unapproving, and deleting comments
Comment 2 Lucas Gass (lukeg) 2024-06-13 21:51:04 UTC
Created attachment 167702 [details] [review]
Bug 37074: Comment approval and un-approval should be CSRF-protected

This patch converts the "Approve" and "Unapprove" controls in the staff
client's comment moderation page so that the operations are POST instead
of GET.

To test, apply the patch and restart services.

- If necessary, enable OPACComments and submit a few comments on a few
  titles in the OPAC
- Go to Tools -> Comments
- Test the process of approving, unapproving, and deleting comments

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 3 Jonathan Druart 2024-06-14 07:27:40 UTC
Created attachment 167707 [details] [review]
Bug 37074: Comment approval and un-approval should be CSRF-protected

This patch converts the "Approve" and "Unapprove" controls in the staff
client's comment moderation page so that the operations are POST instead
of GET.

To test, apply the patch and restart services.

- If necessary, enable OPACComments and submit a few comments on a few
  titles in the OPAC
- Go to Tools -> Comments
- Test the process of approving, unapproving, and deleting comments

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 4 Jonathan Druart 2024-06-14 07:27:43 UTC
Created attachment 167708 [details] [review]
Bug 37074: Do no pass biblionumber

It is not used in the controller

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 5 Wainui Witika-Park 2024-07-18 04:41:21 UTC
Patch doesn't apply cleanly for 23.05.x, could this please be rebased?
Comment 6 Katrin Fischer 2024-07-18 10:53:20 UTC
Hi Wainui, this used cud- from the big CSRF bug, so it doesn't apply beyond 24.05.
Comment 7 Wainui Witika-Park 2024-07-18 23:08:15 UTC
(In reply to Katrin Fischer from comment #6)
> Hi Wainui, this used cud- from the big CSRF bug, so it doesn't apply beyond
> 24.05.

Ok, thanks!
Comment 8 Lucas Gass (lukeg) 2024-07-25 15:20:07 UTC
This has been backported to 24.05.x-security branch for 24.05.02
Comment 9 Katrin Fischer 2024-08-01 15:33:56 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 10 Fridolin Somers 2024-09-10 07:42:48 UTC
CSRF with "cud-" not backported to 23.11.x