Commit Graph

62 Commits (0206fcf963042dc8d7ecd2d2ff113c4ab4977b16)

Author SHA1 Message Date
Isaac Connor ffe6362dc3 fix: harden web interface against injection and SSRF vulnerabilities
FilterTerm.php:
- Replace eval() with safe compare() method for SystemLoad, DiskPercent,
  and DiskBlocks filter conditions (RCE via crafted op/val)
- Validate operator against allowlist in constructor
- Sanitize collate field to alphanumeric/underscore only (SQLi)

onvifprobe.php:
- Use escapeshellarg() on interface, device_ep, soapversion, username,
  and password arguments passed to execONVIF() (command injection)

Event.php:
- Use escapeshellarg() on all arguments to zmvideo.pl instead of
  escapeshellcmd() on the whole command (command injection via format)
- Anchor scale regex with ^ and $ to prevent partial matches

image.php:
- Restrict proxy URL scheme to http/https only (SSRF via file:// etc)

filterdebug.php:
- Use already-sanitized $fid instead of raw $_REQUEST['fid'] (XSS)

MonitorsController.php:
- Use escapeshellarg() on token, username, password, and monitor id
  in zmu shell command instead of escapeshellcmd() on whole command

HostController.php:
- Use escapeshellarg() on path in du command (command injection via mid)
- Remove space from daemon name allowlist (argument injection)

EventsController.php:
- Remove single quotes from interval expression regex (SQLi)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 23:30:49 -04:00
Isaac Connor ba0aa29cdb Merge branch 'master' of github.com:ZoneMinder/zoneminder 2026-01-16 14:55:33 -05:00
Isaac Connor 0ecb344723 Don't contain Tag so we don't include Tag and event_Tag in results. 2026-01-05 17:49:46 -05:00
Steve Gilvarry 58a0e68731 Add Tags to event search and return tag data with events 2026-01-05 21:43:27 +11:00
Isaac Connor 9c79b1ad6e Make filtering by Tags.Id work 2025-12-19 17:50:10 -05:00
Isaac Connor 9351835815 Update use of allowedmonitors 2025-11-19 09:24:46 -05:00
Isaac Connor dbbe2cbcb8 Add EndDateTIme IS NULL condition when using DateTime 2025-10-30 13:53:28 -04:00
Isaac Connor 802ccdcaa9 Use event->can_view to restrict viewing event 2025-10-23 13:56:33 -04:00
Isaac Connor 65d51c7d0a Add support for DateTime as a filter, which means either StartDateTime OR EndDateTime. This allows montagereview to include video that starts BEFORE the requested time but ends after 2025-10-23 13:53:57 -04:00
Isaac Connor 1dde898154 Add support for NOT using named params, using query string instead 2025-09-05 12:42:13 -04:00
Isaac Connor d5e81d3c4a Fix incorrect use of eventObjas an array. 2025-07-19 18:29:22 -04:00
Isaac Connor 97877335db Add MaxScoreFrameId to the events table and automatically update it during event creation so we don't have to look it up later. Finding the frame with the max score is actually a very heavy query, so lets not do it. 2025-07-15 16:17:36 -04:00
Isaac Connor c3d4b12286 Do pagination if either page or limit is specified. Otherwise return all 2025-07-11 17:40:54 -04:00
Isaac Connor 7a3a5ca58a If request includes pagination= then restore the old pagination code. 2025-07-09 17:24:02 -04:00
Isaac Connor ce76f953dc Use limit if it is specified 2025-06-21 21:43:01 -04:00
Isaac Connor d97b37f83f Don't do pagination in events.This may break users of API but pagination should only happen if asked for 2025-06-11 14:57:54 -04:00
Isaac Connor 1ab66b10b1 Don't assume findByEventidAndType actually returns a frame. If we are only recoridng, then there will be no alarm frames in the db 2024-01-16 09:50:19 -05:00
Isaac Connor 065bed894c Use empty array instead of null for allowedMonitors 2023-11-24 08:57:35 -05:00
Isaac Connor 6232cfb8b1 Remove 100 limit on response to events index. Handle there not being a next or prev neighbour. 2023-11-16 18:00:30 -05:00
Isaac Connor 8fd33b7f77 Handle case when Alarm frame or MaxScore frame don't exist. 2023-10-15 17:55:44 -04:00
Isaac Connor 8a00be8cc8 Load the ZM::Event using the Event Model data instead of loading by Id which goes back to db. 2023-06-09 10:53:10 -04:00
Isaac Connor 49014ac7fa replace MonitorIds with viewableMonitorIds 2023-04-24 13:53:14 -04:00
stefan 1bd9def63e [API] Fix User variable from array to object
Fix $user variable from array to object to make API work again.
2023-04-23 22:07:24 +02:00
Pliable Pixels 6c3f18a347 allow option to not load the frames DB table 2021-06-27 15:55:10 -04:00
Isaac Connor 6ed006bc60 rename StartTime and EndTime to StartDateTime and EndDateTime in the named query params 2020-11-06 12:25:04 -05:00
Isaac Connor d37bce4e0e Fix missed StartTime to StartDateTime 2020-11-04 18:20:59 -05:00
Pliable Pixels 8ad62b8905 another try at fixing Eventcontroller 2020-09-13 16:43:49 -04:00
Pliable Pixels a261efe0a7 return relative frameId, also sort score frame by lowest frame to avoid bulk frames incase score is 0 2020-03-09 12:04:40 -04:00
Pliable Pixels 3611d147e6 fix score frameID to return ID not Score 2020-03-09 11:25:07 -04:00
Pliable Pixels c5e838fa33 return global frame IDs of snapshot and alarm frames for a specific event 2020-03-09 11:09:20 -04:00
Isaac Connor 76d795f413 add rendering of enums for Events Controller 2019-12-01 12:32:14 -05:00
Pliable Pixels c4dc5f34e4 add event file system path to API (#2639) 2019-06-16 11:59:23 -04:00
Pliable Pixels d270fbd0ad added support for named params to consoleEvents (#2571) 2019-04-09 16:28:46 -04:00
Isaac Connor fa9803d819 Can't use this->data to avoid another db hit. Must load by id 2019-04-01 10:11:56 -04:00
Matthew Noorenberghe abb6ef1688 API: Escape 'named' params for SQLi in two more Event endpoints.
Fixes #2099
2019-03-11 00:21:51 -07:00
Matthew Noorenberghe 056b96f7fc API: Monitor and Event 'index' SQLi. Fixes #2099 2019-03-11 00:21:51 -07:00
Andrew Bauer 3258d8e590 remove ZM_DIR_IMAGES (#2374) 2018-12-29 09:52:58 -05:00
Isaac Connor 23ddc83ad4
fix_2167 (#2168)
* Populate a global  from the session on every request. Use the  object instead of using allowedMonitors in session.

* fix when  gets loaded.

* use  for auth, and add Monitor Edit checks to Zone add/delete/edit

* add back the ZM_OPT_USE_AUTH test for being logged in in AppController

* Update permissions code to use

* change quotes

* Update permission code to use

* Use  instal of session for systemPermission

* deprecate montiorPermision in session

* use  instead of session streamPermission

* move login code back into AppController. Has to be done for every request

* deprecate eventPermission, controlPermission and systemPermission in session.

* handle auth params in query string as well as post

* exit on HUP to free up memory.

* add missing global user

* system should be System
2018-08-08 09:59:46 -04:00
Isaac Connor dc57a3c91c fix spacing/quotes/google code style 2018-07-24 16:41:09 -04:00
Isaac Connor 62edca6dcb add fileSize to the api, and use it to add remote fileSize reporting in includes/Event 2018-05-08 13:33:56 -07:00
Isaac Connor 1a012c62ff Add fileExists to event view 2018-05-07 14:07:03 -07:00
Isaac Connor 85b7baa131 Fix event Groups associations 2017-12-19 18:09:41 -05:00
Isaac Connor d312482a2b add StorageScheme to Storage and Events. Deprecate ZM_USE_DEEP_STORAGE 2017-12-18 12:52:26 -05:00
Isaac Connor dd69bc3d7b Merge branch 'master' into storageareas 2017-12-11 11:39:42 -05:00
Isaac Connor ef1af9cc15 disable FilterComponent as it doesn't actually do anything. Add Groups join when needed 2017-12-09 14:03:42 -05:00
Pliable Pixels 08b5c26a15 2019 maxscoreframeid (#2020)
* added MaxScoreFrameId to address #2019

* consistent quotes
2017-12-07 14:11:06 -05:00
Isaac Connor f7a2db4e49 remove MaxScore from the sorting because it really doesn't make sense to sort by time then maxscore... time is going to be pretty much unique 2017-12-04 21:50:29 -05:00
Isaac Connor 97c9ae02c2 cleanup 2017-12-04 17:02:38 -05:00
Isaac Connor 6270408c8f rework group MonitorIds and add GroupId filters to api 2017-12-04 15:52:16 -05:00
APHW2 MFGENG f093cfbcef add Filtering to monitors index 2017-11-13 10:27:24 -08:00