Koha-clms/tools
Martin Renvoize da3a09f5ea
Bug 42746: (QA follow-up) Sanitize agefield and substitution field at the sink too
The original fix only whitelisted agefield, condition_field, and
substitution_field at the point they're saved in
tools/automatic_item_modification_by_age.pl, leaving the actual
consumer of the stored syspref, C4::Items::ToggleNewStatus, trusting
agefield and substitution field unchecked. agefield is spliced
directly into raw SQL (TO_DAYS($agefield)) and so can't be
parameterized like an ordinary value; substitution field reaches a
dynamic method call ($item->$field($value)). Any future or
alternate writer of the automatic_item_modification_by_age_configuration
syspref would have reopened both holes without touching the form at
all.

This adds the same allow-list validation directly in ToggleNewStatus
(falling back to the safe default agefield, or skipping the
substitution/condition, exactly as before for missing values), shares
the age-field allow-list between the two files via a new
GetAutomaticItemModificationAgeFields() in C4::Items so it can't drift
between them, and logs rejected values via Koha::Logger instead of
silently discarding them so tampering leaves an audit trail.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-07-30 08:22:29 +00:00
..
csv-profiles
…
access_files.pl
…
additional-contents.pl
…
ajax-inventory.pl
…
automatic_item_modification_by_age.pl
…
batchMod.pl
…
batch_delete_records.pl
…
batch_extend_due_dates.pl
…
batch_modify_holds.pl
…
batch_record_modification.pl
…
batch_records_ajax.pl
…
cleanborrowers.pl
…
copy-holidays.pl
…
csv-profiles.pl
…
exceptionHolidays.pl
…
export.pl
…
holidays.pl
…
import_borrowers.pl
…
inventory.pl
…
letter.pl
…
manage-marc-import.pl
…
marc_modification_templates.pl
…
modborrowers.pl
…
newHolidays.pl
…
overduerules.pl
…
page.pl
…
picture-upload.pl
…
problem-reports.pl
…
quotes-upload.pl
…
quotes.pl
…
scheduler.pl
…
showdiffmarc.pl
…
stage-marc-import.pl
…
stockrotation.pl
…
tools-home.pl
…
upload-cover-image.pl
…
upload-file.pl
…
upload.pl
…
viewlog.pl
…