mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-11-30 20:26:05 -05:00
Follow-up to the numeric field-name guard. FilterComponent::buildFilter() takes an optional $validFields allow-list, but only EventsController's search index and MonitorsController (via qualifyFields) used it; the other index/search/ consoleEvents call sites passed none, so a field name was checked only by the character class, not against a known column set. Pass array_keys($this->Model->schema()) - the pattern EventsController already uses - at the remaining sites across Configs, EventData, Events (three), Frames, Groups, ServerStats, Snapshots, Storage, Tags and UserPreference, so a field must be a real column of the queried model and an unknown field is a 400 rather than a MySQL 500. The injection itself is already closed by the numeric field-name guard; this is defense in depth and consistent error handling. ServerStatsController's commented-out permission check is left as-is (clients need the data to render monitors); only the allow-list is added there. Add tests/php/test_api_filter_fields_enforced.php. Reported by arpitjain099. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>