Bug 16593: Do not allow patrons to delete search history of others patrons
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 26 May 2016 10:52:19 +0000 (11:52 +0100)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 24 Jun 2016 11:47:29 +0000 (11:47 +0000)
commitf01720808a574af9872ef3f562a8f3cee7f81060
treeb4b2b585d59a35186d08e95f9b154572b3f8abbc
parent33f1354b7b50390b43e5a2f66e1abe58817e6d4d
Bug 16593: Do not allow patrons to delete search history of others patrons

A malicious user can delete the search history of all other users by
correctly guessing the ID value assigned to the victim's search. As
searches are assigned values sequentially, an attacker could quickly
remove the searches belonging to all of the application's users.

To reproduce:
Login with patron A
launch a search
Note the id generated for this search history:
select id from search_history order by id desc limit 1;
Login with patron B
Hit /cgi-bin/koha/opac-search-history.pl?action=delete&id=<ID>
Note that the row is deleted in the DB

Test plan
Confirm that this patch fixes the issue.
The same test can be made at the staff interface

Reported by Alex Middleton at Dionach

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
catalogue/search-history.pl
opac/opac-search-history.pl