mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-11-30 12:14:36 -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>
ZoneMinder API
This is the ZoneMinder API. It should be, for now, installed under the webroot e.g. /api.
app/Config/database.php.default must be configured and copied to app/Config/database.php
In addition, Security.salt and Security.cipherSeed in app/Config/core.php should be changed.
The API can run on a dedicated / separate instance, so long as it can access the database as configured in app/Config/database.php