Commit Graph
144 Commits
Author SHA1 Message Date
Harsh Singh b1251a623a fix: API saves refuse a list or object sent for a plain column (#8110) 2026-11-24 19:31:01 -05:00
Harsh Singh fe1c0c12e5 fix: API monitor edit checks the Device path against the stored Type when the request has no Type (#8089) 2026-11-24 19:10:45 -05:00
Harsh Singh bc73a3f781 fix: use Validation::notBlank in the Role and Frame models instead of the deprecated notEmpty (#8087) 2026-11-24 19:10:41 -05:00
Jash Ambaliya aac769dd54 fix: orphaned empty events end at their start in API EndTime and timeline range refs #7821 (#7822) 2026-11-24 18:07:03 -05:00
Harsh Singh 48fb520cce fix: require Name on API camera model and encoder template add (#7970) 2026-11-23 23:04:48 -05:00
Harsh Singh bdfabb22ff fix: API zone edit converts pixel thresholds when Coords are not sent (#7968) 2026-11-23 23:04:43 -05:00
Harsh Singh a3d7091ca3 fix: API users index and view include the user's Role (#7966) 2026-11-23 23:04:39 -05:00
Jash Ambaliya 2609b71119 fix: API snapshot add records the authenticated user and time, and edit cannot change them refs #7598 (#7599) 2026-11-23 08:49:52 -05:00
Jash Ambaliya 989224a903 fix: API storage add and edit refuse a Name or Path with characters the web console strips refs #7648 (#7649) 2026-11-23 08:49:45 -05:00
Jash Ambaliya db13a3f664 fix: API user add requires Username and Password refs #7488 (#7489) 2026-11-23 08:48:32 -05:00
Jash Ambaliya d9e9ec159b fix: role view lists members without their password hash refs #7482 (#7483) 2026-11-23 08:48:20 -05:00
Jash 7ed5e0be24 fix: API monitor save rejects names with characters the web UI strips refs #7454 2026-11-22 10:57:24 +05:30
Isaac Connor 7432fc7246 Merge pull request #7330 from AJ0070/fix-api-states-controller
fix: API refuses run states named start, stop, restart, status, logrot or version, as the web UI does
2026-11-21 20:53:09 -05:00
Jash 1d8abd49f4 fix: API refuses run states named start, stop, restart, status, logrot or version, as the web UI does refs #7329 2026-11-22 06:07:02 +05:30
Jash e0e2eb1ff7 fix: API zone edit with only Coords keeps a Percent zone's coordinates in percent refs #7161 2026-11-21 23:05:20 +05:30
Jash af5821e04a fix: API daemonControl reports an error when the command did not run or zmdc failed refs #6757 2026-11-19 09:16:17 +05:30
Isaac Connor 623c890037 Merge pull request #6357 from AJ0070/fix-api-zones-monitors-index
fix: API zone save sets area and percent thresholds, zones and presets index filters, monitors sort
2026-11-17 08:43:48 -05:00
Isaac Connor 4d5ebcbfa1 Merge pull request #6570 from AJ0070/fix-api-event-stateid
fix: API event add without StateId
2026-11-17 08:12:19 -05:00
Jash 7348cc0318 fix: API snapshot add fills CreatedBy and CreatedOn refs #6571 2026-11-17 10:05:59 +05:30
Jash 9d7f95538f fix: API event add defaults StateId to the active run state refs #6569 2026-11-17 10:05:50 +05:30
Jash 9b80e9c086 fix: API camera model manufacturer join, encoder template and role name uniqueness refs #6463 2026-11-16 17:37:08 +05:30
Jash 33b4c40368 fix: API zone save sets area and percent thresholds, zones and presets index filters, monitors sort refs #6356 2026-11-16 12:28:41 +05:30
singhharsh1708 c85c87ae53 fix: stop the API logging a missing validation handler on every user preference and event data save 2026-11-16 03:05:12 +05:30
Isaac Connor f3b2027e1b Merge pull request #5945 from AJ0070/api-monitor-zone-event-fixes
fix: API deleted monitors, default zone, monitor and zone validation, event pagination and file fields
2026-11-15 11:31:23 -05:00
Isaac Connor 598a84f3b5 Merge pull request #5689 from AJ0070/zmu-credentials-escaping
fix: stop escapeshellcmd mangling escaped zmu and daemon arguments
2026-11-15 11:24:34 -05:00
Jash 8599c75703 fix: return 0 for the API event fileExists and fileSize when the video is missing refs #5944 2026-11-15 11:17:26 +05:30
Jash 462409ce1a fix: validate API zone coordinates and write percentages with decimals refs #5944 2026-11-15 11:17:26 +05:30
Jash f7e16bdaa7 fix: reject a blank monitor name, zero size and unknown server or storage in the API refs #5944 2026-11-15 11:17:26 +05:30
Jash cd48a6967d fix: accept the webm output container when saving a monitor through the API refs #5928 2026-11-15 09:47:15 +05:30
Isaac Connor 28d463b325 Merge pull request #5913 from AJ0070/api-snapshot-tag-saves
fix: API snapshots and tags index, save errors and tag delete
2026-11-14 18:46:41 -05:00
Isaac Connor e2b3550b1b Merge pull request #5919 from AJ0070/api-admin-resource-saves
fix: id pinning and validation errors in API resource saves
2026-11-14 18:05:45 -05:00
Isaac Connor 312a16447c Merge pull request #5917 from AJ0070/api-log-key
fix: use Id as the API log key and fix logs view, add and filters
2026-11-14 18:05:02 -05:00
Isaac Connor 07153c73d8 Merge pull request #5811 from AJ0070/notifications-validation
fix: validate Notifications API input
2026-11-14 15:38:41 -05:00
Jash b5fa1aa4b3 fix: check string lengths against the schema in API saves so an over-long value is a field error and not a 500 refs #5918 2026-11-14 23:05:47 +05:30
Jash 65b56bc90b fix: pin the API encoder template id on save, answer a failed save with 422 and require Params on create refs #5918 2026-11-14 23:05:47 +05:30
Jash dbc664a6f4 fix: pin the API manufacturer and model id on save, refuse duplicate names and answer a failed add with the validation errors refs #5918 2026-11-14 23:05:46 +05:30
Jash 7c466cee05 fix: use the Id column as the API log key, apply named filters to the logs index, serialize the log view and require the not null log fields refs #5916 2026-11-14 23:05:29 +05:30
Jash a37b7c0952 fix: answer a failed API tag add or edit with the validation errors, refuse a duplicate tag name and let a tag with events be deleted refs #5912 2026-11-14 23:05:16 +05:30
Jash 9bb77bbf6b fix: stop the API snapshots index repeating a snapshot per event, return the events in associations and the validation errors on a failed add or edit refs #5912 2026-11-14 23:05:16 +05:30
Isaac Connor 40ada52b42 Merge pull request #5835 from AJ0070/api-input-validation
fix: validate API input against the column types before saving
2026-11-14 11:59:38 -05:00
Jash 23daf1e42c fix: validate username uniqueness and length on the User model refs #5858 2026-11-14 19:16:47 +05:30
Jash d0531a5072 fix: return a validation error instead of a 500 for an API state without a definition or a zone without coords refs #5834 2026-11-14 18:57:35 +05:30
Jash 66619319d9 fix: validate number, date and enum values in API saves so a bad value is a field error and not a 500 refs #5834 2026-11-14 18:57:35 +05:30
Jash 79f9f593b8 fix: validate Notifications token, platform and numeric fields so bad input returns 400 not 500 refs #5810 2026-11-14 18:42:35 +05:30
Jash cd4531655e fix: stop escapeshellcmd mangling escaped zmu and daemon arguments fixes #5688 2026-11-13 13:43:59 +05:30
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
Nic Boet fd93780425 fix: refuse the password admin wherever a password is set refs #5287
The login page's change form and the first-run page refused admin as a
new password, but the user page (Options, Users, and a user's own page
with ZM_USER_SELF_EDIT) and the API (users/add, users/edit) still stored
it. Every login then refused that account.

Check a new password in one place, passwordProblem() in auth.php, and
call it from all four:

- includes/actions/user.php, for an admin's edit and a self edit: the
  save stops with the reason shown on the page. A Password sent as an
  array is refused too (it reached password_hash() before).
- api/app/Model/User.php: an "acceptable" validation rule, so add and
  edit answer with the reason as the validation message. The API loads
  no language file, so passwordProblemText() gives it the English.
- newPasswordProblem() (both login-page forms) checks the confirmation,
  then passwordProblem().

Tests: tests/php/test_default_password.php covers passwordProblem() and
passwordProblemText().
2026-10-16 10:12:53 -05:00
Isaac ConnorandClaude Opus 5 bf8a73e9fb feat: remove Libvlc from the web ui, api and config help
Follows the daemons: no monitor can be type Libvlc any more, so the ui
should not offer it or carry text describing it.

Drops the source-type option and its deprecation notice, the Libvlc arm
of the Source Path and console source-column branches, the entry in the
control-capability type list, and the value from the api's Type
validation list. The OPTIONS_LIBVLC help block goes from all 25 language
files: monitor.php builds that key as OPTIONS_ plus the monitor type, so
it became unreachable the moment the type did. The Libvlc source-type
label goes from the 22 files that carried it.

SourceTypeDeprecated and Deprecated lose their last caller and are
removed. RemoteRtspDeprecated and Removed stay -- the rtsp protocol
option is still shown to monitors already set to it.

The WEB_FILTER_SOURCE help listed the affected source types; corrected
in ConfigData.pm.in and in the one translation that had localised it.

All 25 language files and the four edited php files parse clean under
php -l, and the config module parses under perl -c. No javascript
changed, so eslint has nothing to say here -- it cannot run in this
worktree anyway, which has no node_modules.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015Y6FieTwEXuLhhR4e2yiax
2026-10-10 09:32:17 -04:00
nicandClaude Opus 5.5 ed8d648efa fix(api): key States by Id so view, edit and delete work (#5173)
The State model still declared primaryKey = 'Name' from before
zm_update-1.28.99 gave States an Id primary key. The REST routes only
match numeric ids, so states/<id>.json view/edit/delete looked up a
state *named* <id> and always failed, and names don't match the routes.
Through states/edit/<name>.json, edit never set the record id and
inserted a new nameless state instead of updating; view had no
_serialize and returned 500.

Use the default Id key. view serializes the state; edit sets the id,
accepts POST/PUT only and, like add, answers {message: Saved} or the
validation errors (as Monitors and Zones do) instead of an empty flash.
Names must be non-empty and unique, since zmpkg.pl and
states/change/<name> select states by name. index, change and delete
are unchanged.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 17:44:00 -04:00
Isaac ConnorandClaude Opus 5.5 c4ef3fdd62 feat: key Frames by (EventId, FrameId) and drop the surrogate Id refs #5164
Every query on Frames filters on EventId and orders or ranges by FrameId,
and nothing needs a frame by Id. The Id primary key was a clustered index
nothing read, and EventId_FrameId_idx was a secondary index every query
used. On a copy of a local table that secondary index was half the
table's size. With (EventId, FrameId) as the primary key the index is
gone, and an event's rows are stored together, so deleting an event is a
range delete.

zm_update-1.39.36.sql:
- converts AI_Detections.FrameId from Frames.Id to the per-event frame
  number, drops its foreign key to Frames and indexes (EventId, FrameId).
  A composite foreign key cannot replace it: ON DELETE SET NULL would
  have to null the NOT NULL EventId, and Frames rows are written in
  batches, so a detection can be recorded before its frame row.
- removes duplicate (EventId, FrameId) rows, keeping the earliest.
- rebuilds Frames with the new primary key.
- removes ON UPDATE CURRENT_TIMESTAMP from Frames.TimeStamp. Any UPDATE
  of a frame row was overwriting its capture time.
Each step checks the current schema first, so the migration can be
re-run.

REST API: view, edit and delete take /frames/<action>/<EventId>/<FrameId>.json.
The old single-Id URLs return 404. CakePHP 2 has no composite keys, so
the model's primaryKey is EventId. That keeps Event's dependent cascade
delete limited to the event's own frames. The controller writes with
explicit (EventId, FrameId) conditions instead of save(), which would
match rows on EventId alone. Edit no longer changes EventId or FrameId.

view=image with fid but no eid used to look up Frames.Id. It now returns
404.

The Perl Frame class is identified by (EventId, FrameId).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 11:48:26 -04:00