* fix: API add and edit answer 400 when the save fails in 13 more controllers, as Users and Notifications do refs #7383
* test: misc API controllers test gives its stub controller a response, as the controllers now set a status refs #7383
---------
Co-authored-by: Isaac Connor <isaac@zoneminder.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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>