]> git.koha-community.org Git - koha.git/commit
Bug 18854: Make sure offset will not be < 0 - protect from DoS
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 5 Jul 2017 13:44:55 +0000 (10:44 -0300)
committerFridolin Somers <fridolin.somers@biblibre.com>
Tue, 18 Jul 2017 13:29:02 +0000 (15:29 +0200)
commit9939c7f3bf961e5b7789f4d64e0fc074408b71b1
treecc614ffc7fcbafadb4c59f4abcd2991499815f0e
parenta64d14db20ac55fe4bcc8de06207c516d2237788
Bug 18854: Make sure offset will not be < 0 - protect from DoS

There was a bug that meant a very large offset in the search params
will cause the search script to run forever (or long enough to crash
the machine)

To test

1/ Get ready with sudo top so you can kill the thread before it causes
your machine to OOM
2/ Hit a page like yourdomain.com/cgi-bin/koha/opac-search.pl?q=1&offset=-9999999999999999999
3/ Notice the process runs for a long time
4/ Kill the process
5/ Apply the patch
6/ Hit the page again, notice the it loads (offset is set to zero)
7/ Do the same to search in the staff client

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit aabf001232fc46ee04cecb3a43fe8c0366a091df)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
C4/Search.pm
Koha/SearchEngine/Elasticsearch/Search.pm