Commit Graph
181 Commits
Author SHA1 Message Date
Isaac Connor 86876ce8c0 Merge pull request #5813 from AJ0070/console-fixes
fix: console sort, search, column sorting, name filter, totals and Offline status
2026-11-14 12:24:20 -05:00
Isaac Connor 3e1df49c2a Merge pull request #5815 from AJ0070/options-fixes
fix: options save for dependent booleans, numeric validation, menu reset and restart warning
2026-11-14 12:23:09 -05:00
Isaac Connor 41b6feec1e Merge pull request #5817 from AJ0070/log-view-fixes
fix: log view search, debug levels, paging order and client message encoding
2026-11-14 12:21:57 -05:00
Isaac Connor c267d2ec87 Merge pull request #5823 from AJ0070/cron-fixes
fix: scheduled tasks for deleted monitors, save errors and trailing backslash
2026-11-14 11:59:05 -05:00
Isaac Connor 7128c19fb2 Merge pull request #5825 from AJ0070/storage-fixes
fix: don't delete storage in use and keep non-ASCII storage names and paths
2026-11-14 11:52:45 -05:00
Isaac Connor dbf3ab81a0 Merge pull request #5837 from AJ0070/event-delete-fixes
fix: event deletion order, archived checks and directory cleanup
2026-11-14 11:49:45 -05:00
Isaac Connor 06e2808bf6 Merge pull request #5839 from AJ0070/user-form-fixes
fix: user delete, home view default, self edit form and username checks
2026-11-14 11:47:49 -05:00
Isaac Connor 00f27f80ea Merge pull request #5843 from AJ0070/control-ui-fixes
fix: control capability checkbox reset, Cancel link, monitor Control Edit button and protocol fallback
2026-11-14 11:46:39 -05:00
Isaac Connor 2cd672c71f Merge pull request #5851 from AJ0070/frame-view-fixes
fix: frame view navigation, scaling, virtual frames and thumbnails
2026-11-14 11:43:38 -05:00
Jash 04da3080fa fix: keep non-ASCII letters in storage names and paths refs #5824 2026-11-14 21:18:18 +05:30
Jash 87ca767b99 fix: keep each event's own name, cause and notes when editing several events in the event detail modal refs #5852 2026-11-14 19:10:24 +05:30
Jash d7c2d8980b fix: fall back to the default delete confirmation title when the title is empty refs #5852 2026-11-14 19:10:24 +05:30
Jash f7430ba2a9 fix: read the control type in the camera settings modal so bool and int controls render refs #5852 2026-11-14 19:10:24 +05:30
Jash f6191bcf7a fix: post the camera settings modal to the settings view so Save is processed refs #5852 2026-11-14 19:10:24 +05:30
Jash 81d2cef41a fix: let the export make a video for an event with no length instead of dividing by zero refs #5850 2026-11-14 19:09:33 +05:30
Jash 2644d77a1f fix: place frames after the last bulk frame by interpolating to the event end instead of whole seconds refs #5850 2026-11-14 19:09:33 +05:30
Jash 1c9a0b003b fix: clear CanIndicatorLight when its checkbox is unchecked on the control capability form refs #5842 2026-11-14 19:03:45 +05:30
Jash 798aed7060 fix: delete a user's preferences before deleting the user refs #5838 2026-11-14 19:02:06 +05:30
Jash eaa6dce4e2 fix: remove the empty date directory after deleting a Medium scheme event refs #5836 2026-11-14 18:58:30 +05:30
Jash 4359270a34 fix: re-check Archived after reloading the event row before deleting it refs #5836 2026-11-14 18:58:30 +05:30
Jash ad45b6ad3f fix: keep the storage area and monitor directory when deleting the last Deep scheme event refs #5836 2026-11-14 18:58:30 +05:30
Jash d3c1e56e12 fix: delete event rows before files and keep the files when the delete fails refs #5836 2026-11-14 18:58:30 +05:30
Jash 1c4c5e61c3 fix: delete Event_Data rows when deleting an event in the web UI refs #5836 2026-11-14 18:58:30 +05:30
Jash 92d88df34a fix: refuse to delete a storage area still used by events or monitors refs #5824 2026-11-14 18:53:19 +05:30
Jash 9e9d9edca1 fix: reject scheduled commands ending in a lone backslash refs #5822 2026-11-14 18:51:31 +05:30
Jash cb6ad2a723 fix: report failed saves of scheduled tasks and actions, and keep Name within its column refs #5822 2026-11-14 18:51:31 +05:30
Jash ed9bc1b8d3 fix: drop scheduled actions of deleted monitors from the crontab refs #5822 2026-11-14 18:51:30 +05:30
Jash b007deb743 fix: refuse the OFF level in log create so it cannot end the request refs #5816 2026-11-14 18:46:13 +05:30
Jash 68fcd4924e fix: break Log sort ties by id so pages do not repeat rows and sort the Level column by level refs #5816 2026-11-14 18:46:13 +05:30
Jash a14d066eaa fix: let the Log level filter and row colours cover debug levels DB1 to DB9 refs #5816 2026-11-14 18:46:13 +05:30
Jash cde353da10 fix: require every advanced search column to match in the Log view refs #5816 2026-11-14 18:46:13 +05:30
Jash 66265fcd99 fix: reject non-numeric values for integer, decimal and hexadecimal options refs #5814 2026-11-14 18:44:52 +05:30
Jash 7f086afadd fix: keep a boolean option the Options page disabled when its requirements are not met refs #5814 2026-11-14 18:44:52 +05:30
Jash cb4a5cd160 fix: accept delimited and invalid patterns in the monitor Name filter refs #5812 2026-11-14 18:43:31 +05:30
Jash aefbc33bea fix: sort the console by the Source, Server, Storage and Function columns refs #5812 2026-11-14 18:43:31 +05:30
Jash 03be2e46c8 fix: stop the console search matching every monitor on the stale Function column refs #5812 2026-11-14 18:43:31 +05:30
Jash 439b404ce0 fix: stop the console sort action failing with no active transaction after LOCK TABLES refs #5812 2026-11-14 18:43:31 +05:30
Isaac Connor 55671fcd96 Merge pull request #5553 from AJ0070/5552-janus-pin-shm
perf: read the Janus pin from shared memory instead of running zmu
2026-11-12 19:52:58 -05:00
Jash 3f635686a1 fix: take a deleted event's DiskSpace off its Storage in the PHP delete refs #5605 2026-11-12 09:49:11 +05:30
Jash bb36f9b5ac perf: read the Janus pin from shared memory instead of running zmu fixes #5552 2026-11-12 00:27:25 +05:30
Jash 3f1907960a perf: ask zmdc.pl whether ZoneMinder is running once a request fixes #5537 2026-11-11 19:49:28 +05:30
Isaac Connor d32b3d4752 Merge pull request #5069 from AJ0070/fix/4727-clear-logs
fix: clear all logs when no rows are selected
2026-11-10 19:14:43 -05:00
Isaac ConnorandClaude Opus 4.8 04f097b9c0 fix: surface export copy failures and stop output accumulating fixes #5085
exportEvents() copies each event file with exec($cmd, $output, $return)
and only put $return into a ZM\Debug line, so a failed cp never reached
the user and the export still handed back an archive missing files - the
"fails silently" half of #5074. $output was also never reset between
iterations, and exec() appends to a non-empty array, so that Debug line
accumulated every line of output from every file in the export.

Reset $output before each copy, and on a non-zero return log a ZM\Error
and mark the export failed; after the loop, return false when any copy
failed so ajax/event.php reports "Export Failed" instead of serving an
incomplete archive, matching how the tar/zip step already handles its
own exec() status.

tests/php/test_export_copy_failure.php extracts the exportEvents() body
from the real source and checks the reset and the failure handling are
present; it fails against the pre-fix source.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-08 18:07:30 -05:00
Jash 0f5c823378 Merge remote-tracking branch 'upstream/master' into fix/4727-clear-logs
# Conflicts:
#	web/skins/classic/views/js/log.js
#	web/skins/classic/views/js/log.js.php
#	web/skins/classic/views/log.php
2026-11-08 14:54:24 +05:30
Isaac ConnorandClaude Opus 4.8 bf04cfe04c fix: refuse a path-traversal export name in exportEvents/downloadEvents refs GHSA-9hf5-jpww-rvpp
The export-generation path sanitized the user-supplied export directory name with
preg_replace('/[^\w\-.]/', '', ...), a whitelist that keeps dots, so a bare '..'
survived and $export_root became the parent of the export root. exportEvents()
then chmod'd, wrote into, and tarred that parent, and the archive was downloadable
through the safeExportComponent() read guard because it genuinely sat in the
exports dir. downloadEvents() had the same shape via DIR_EXPORTS_DOWNLOAD
(refs GHSA-72h2-rvhv-wr5g).

These are residual siblings of GHSA-fvx4-86xp-9v22, which hardened the download/
read views but left the write path. Refuse a '.'/'..' component in exportEvents(),
and route downloadEvents()'s name through the existing safeExportComponent().

Add tests/php/test_export_path_traversal.php.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-07 10:54:46 -05:00
Isaac ConnorandClaude Opus 4.8 71cae39ed9 fix: pass a field allow-list at every API buildFilter call site refs GHSA-xqfr-6v9x-cvwc
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>
2026-11-07 10:27:31 -05:00
Isaac ConnorandClaude Opus 4.8 71996d18b6 fix: reject all-digit API filter field names in FilterComponent refs GHSA-xqfr-6v9x-cvwc
A named parameter written `0:<payload>` reaches FilterComponent::buildFilter()
as an integer array key, and the field regex `[a-z0-9.]+` matched the all-digit
name, so `$conditions["0"] = $value` cast the key to an int. CakePHP 2.x renders
an integer-keyed condition as a raw, unescaped SQL fragment, so the value went
into the WHERE clause verbatim (UNION exfiltration, ACL bypass via a trailing
comment, blind boolean oracle) at the index() call sites that pass no
$validFields allow-list.

Refuse an all-digit field name in buildFilter(), so every key that reaches
$conditions contains a letter or a dot and stays a string key that CakePHP
quotes. Add tests/php/test_api_filter_numeric_field.php.

Reported by arpitjain099.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-07 10:01:11 -05:00
Isaac ConnorandClaude Opus 5.5 ef29de86d4 fix: check SET_EVENT ids before authorising and packing them refs #4186
stream.php checked the target event's permission using the request
string and then packed intval() of it. On 32-bit PHP intval('2147483648')
is 2147483647, so the check and zms could see different events, and a
non-numeric or array value was cast to whatever intval() made of it.

The ids now have to be digit strings that fit in this PHP's int, or the
request is refused. The checked int is what gets packed. The packing
moved to includes/stream_set_event.php so tests/php can check the bytes
against EventStream::DecodeSetEvent's layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 19:32:53 -05:00
Isaac ConnorandClaude Opus 4.8 05a610a2c6 fix: revoke API tokens when a user's password is changed
Changing a user's password rewrote only the password hash and left the
user's JWT API tokens valid: a pre-change access token kept working and a
pre-change refresh token kept minting new access tokens for up to its 24
hour lifetime, so a leaked token survived the password change meant to
cut it off.

Set TokenMinExpiry to the change time in the same step that rewrites the
hash, so validateToken() rejects every token issued before the change,
matching the options page's existing revoke action. Covered paths: the
REST API User model (beforeSave), with the self-edit controller whitelist
widened to persist the field, and the classic web UI user action for both
the administrator edit and the self edit. The login-time upgrade of a
legacy hash to bcrypt rewrites the same password and is left untouched so
it does not revoke tokens.

refs GHSA-5w6w-qp25-2qqh

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-04 08:26:38 -05:00
Isaac ConnorandClaude Opus 5.5 9e3885e8fd refactor: remove ZM_OPT_FAST_DELETE
With fast deletes on, deleting an event in the web interface removed only
its Events row and left its Frames and Stats rows and its files for
zmaudit, and deleting a monitor left all of its events. zmaudit only runs
when ZM_RUN_AUDIT is on, and both options default to off independently,
so with fast deletes on and the audit off nothing ever removed them and
the Frames table grew without bound. In the Perl Event::delete the option
also kept zmfilter from removing the files of the events it purged.

Remove the option. ZM\Event::delete() always removes the Stats and Frames
rows and the files in one transaction with the Events row,
ZM\Monitor::destroy() always deletes the monitor's events, and the Perl
Event::delete deletes the files unless the storage area has DoDelete off.
zmupdate.pl rebuilds the Config table from ConfigData, so the option's row
goes away on upgrade without a migration. Drop the option from the docs,
from the zmaudit option help, and from the es_la, ro_ro and ru_ru
translations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 22:50:01 -05:00