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>
web/skins/classic/views/plugin.php queried a PluginsConfig table that no
schema or migration creates and read ZM_PLUGINS_CONFIG_PATH, which is not a
ConfigData option, so ?view=plugin could never run. Nothing links to the
view, no menu or router entry references it, and its history shows only
sweeping maintenance edits, never plugin-feature work. It is a vestige of
the old 1.2x plugin experiment.
Remove the view and its per-view skin assets (js/plugin.js and the base,
classic and dark plugin.css). PluginsConfig and ZM_PLUGINS_CONFIG_PATH
appear nowhere else in the tree.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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>
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>
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>
When the next event the page sent has been deleted, zms stops at the end of
the current event. The page only asked again about a 0 boundary, so it kept the
deleted neighbour and zms stayed paused. Ask again every BOUNDARY_REFRESH_MS
while zms reports paused; a different answer is sent and resumes it through
HintResumes. A user's pause is unaffected, since zms only resumes after
stopping at the end of the filter.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the zms path the page can move on to another monitor's event without a page
load, but its elements and PanZoom are built for the monitor it was loaded for.
Looking them up by eventData.MonitorId found nothing after such a change: the
scale timer threw on panZoom[id].getScale(), the zoom buttons stopped showing,
and the stream element was not found. Look them up by domMonitorId(), the
monitor the page was loaded for.
The image also kept the first monitor's size and zms its scale. When the new
event's frames are another size, run changeScale() again. The zones drawn are
the page's monitor's, so hide them and disable the toggle over another
monitor's event, and put them back as they were on returning.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
restartZmsStream reloaded the stream image's original URL, which names the
event the page was opened on. zms moves on by itself, now across monitors, so
recovering from a broken stream started playback over from that first event.
Restart on the last event zms reported, without the first event's frame.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A lookup given up on after LOOKUP_TIMEOUT_MS is retried while the first may
still answer. If the first answered last, its older neighbours replaced the
retry's: a stale 0 disabled Next and sent zms a boundary. Number the lookups
and apply only the reply to the last one; only its completion ends the wait.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each hint is its own request, so two sends for the same event, such as a
boundary 0 and then the event found by the refresh, could reach zms out of
order and leave it with the older one. The page now waits for the replies to
one send before starting the next; a zms restart drops that wait, since the
old commands went to the old process.
When zms stopped at the end of an event because the filter had nothing
further, or the hint came too late, a hint arriving afterwards was stored but
playback stayed paused, so an event recorded since was never played. A
SET_EVENT that names an event in the direction we stopped in now resumes
through the end-of-event wait, unless a user command came in between.
Give up on an unanswered neighbour lookup after 5s rather than 10s, so a
retry still arrives within zms's 10s wait.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>