Bug 34349: Validate/escape inputs for task scheduler
authorDavid Cook <dcook@prosentient.com.au>
Mon, 24 Jul 2023 04:31:15 +0000 (04:31 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Mon, 25 Sep 2023 21:18:38 +0000 (18:18 -0300)
commitdcd698a4b4ed7f3a714ef35fe83c007fce9d52ae
treebf51d365904f2997f46a67b2e5d26afc197336dd
parent332b95b2507184e20cd70ddfb16c6f5a260d6dc0
Bug 34349: Validate/escape inputs for task scheduler

This change validates and escapes inputs for task scheduler.

Test plan:
0. Apply patch
1. koha-plack --reload kohadev
2. Go to http://localhost:8081/cgi-bin/koha/tools/scheduler.pl
3. Input a time a minute in the future and leave the date blank
4. Choose an existing report and output format
5. Type a malicious string which is also a valid email address
into the Email field
6. Click "Save"
7. Note that the job is added but the Email is wrapped in single
quotes
8. Try using a non-malicious email address with a single quote.
9. Note that the single quote is escaped, so that it will still
be used by runreport.pl

JD amended patch: tidy

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Removed pars for $email =~ regex, removed old commented lines.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
tools/scheduler.pl