Commit Graph
53 Commits
Author SHA1 Message Date
Isaac ConnorandClaude Opus 5.5 c3d2e542bc fix: never build an object from an id the request sent as an array
ZM_Object's constructor treats an array as the object's row, and validInt()
and validCardinal() returned an array as they got it (preg_replace() does).
So wherever a request id reached `new ZM\X(...)`, raw or through those
validators, a crafted array built an object whose Id, UserId or MonitorId
the sender chose. The permission check then looked at those, and the delete
or update that followed used the Id. A user with Events=View deleted another
user's filter by posting Id[Id]=<filter>&Id[UserId]=<self> to the filter
delete action; the same shape reached events (MonitorId), users, reports,
snapshots and storage.

validInt() and validCardinal() now give '' for anything that isn't a single
value. The places that built an object from a raw $_REQUEST value (the
control and event ajax handlers, the event, filter, report, snapshot and
storage actions, view_hls, and the download and event detail modals) take
the id through validCardinal().

tests/php/test_request_ids_scalar.php covers the validators with arrays and
fails if web code builds an object straight from $_REQUEST, $_GET or $_POST.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 23:07:08 -04:00
Isaac Connor e0a12a7392 fix(tags): validate addtag ids and include database.php in TagOrder refs #5021
Follow-up to review comments on PR #5022.

addtag passed $_REQUEST['tid'] and $_REQUEST['id'] straight into the
Events_Tags INSERT and the Tags UPDATE, while only the TagOrder call
sanitized tid. A non-numeric tid therefore still inserted a row with the
value coerced to 0, and only the recency bookkeeping was skipped.
Validate both ids once at the top of the case, reject non-scalar values
(array-form parameters such as tid[]=1, which validCardinal would return
as an array and bind as one), and reuse the sanitized values for all
three statements.

TagOrder.php calls dbFetchOne/dbQuery but did not pull in the database
helpers itself, relying on the caller having done so. Both current call
sites happen to, but that is incidental; require_once('database.php') to
match Tag.php and User_Preference.php.
2026-08-08 11:33:11 -04:00
Simpler1 bc700595dc fix(tags): PHP solution for personal tag order 2026-07-29 09:51:55 -04:00
IgorA100 b5bd306a4c We'll limit ourselves to transferring no more than 100 links and additional file name validation. (event.php) 2026-06-05 11:49:22 +03:00
IgorA100 e6975e014a We will prohibit the use of the ../ combination in paths. (event.php) 2026-06-04 09:52:37 +03:00
IgorA100 e328333074 - DIR_EXPORTS_DOWNLOAD is not passed to JS, but is used only in PHP.
- When making an AJAX request, we pass an array of file paths relative to DIR_EXPORTS_DOWNLOAD , not absolute ones.
- Check $fileName for a non-empty string.
- Clear fileExistencePollingInterval if it exists before calling again.
- More correctly retrieve parameters from the "el.href" string using "new URL(el.href)".
- Disabled the cursor for "a.disabled".
2026-06-01 12:45:12 +03:00
IgorA100 f465309183 Added AJAX action='file_existence_check'
Added the DIR_EXPORTS_DOWNLOAD constant from PHP to JS
Added a style for "#downloadModal a.disabled" on the Events page
2026-05-30 23:28:40 +03:00
Isaac Connor 644716b4ea fix: sanitize reflected user input in ajax error messages
Earlier commits in this branch dropped reflected user input from
ajaxError() messages entirely to close Snyk XSS findings, but that
lost useful diagnostic information ("Unrecognised action <name>",
"Insufficient permissions for user <user>"). Use validHtmlStr()
(htmlspecialchars with ENT_QUOTES) so the values still appear in
the message and Snyk recognises the sanitization. Affects
add_monitors.php, device.php, event.php, events.php, log.php.
2026-05-13 22:54:02 -04:00
Isaac Connor 2c50a99368 fix: sanitize download params at event ajax boundary
The download action passed $_REQUEST['exportFormat'] and connkey
through downloadEvents() into ajaxResponse() unsanitized. Constrain
exportFormat to the allowlist ('tar'/'zip') and strip non-[\w.-]
chars from connkey at the call site.
2026-05-13 16:06:36 -04:00
Isaac Connor 0d197c9035 fix: sanitize export filename and connkey at event ajax boundary
$_REQUEST['exportFile'] and $_REQUEST['connkey'] flowed through
exportEvents() into ajaxResponse() (i.e. exit(jsonEncode())).
exportEvents() already sanitizes both internally via the same
preg_replace, but Snyk can't trace through the function — sanitize
at the call site so the taint is closed at the boundary.
2026-05-13 15:59:33 -04:00
Isaac Connor 4163feb939 fix: remove reflected user input from event ajax XSS sink
The catch-all ajaxError() at the bottom of event.php reflected both
$_REQUEST['action'] and the session username. Same Snyk pattern as
add_monitors.php and device.php. Action is now logged server-side
via ZM\\Warning; user-facing message is static.
2026-05-13 15:56:49 -04:00
Isaac Connor 286feece4c Move tag related commands to canView(Events) instead of canEdit(Events) 2026-03-12 15:03:29 -04:00
IgorA100 fc491ab12c Changed the function name from "exportEvents" to "downloadEvents" (event.php) 2025-12-18 00:52:36 +03:00
IgorA100 0020d29c89 Removed the ":" character from allowed characters (event.php) 2025-12-11 12:39:18 +03:00
IgorA100 b1f65aaabc Fix: Allow using any character from the "letter" category in the name of the downloaded event archive (event.php)
This change will allow the use of any national Unicode alphabet in the file name.
We also allow any numeric character and the characters "-", ".", "(", ")"
The ":" character is prohibited in file names in Windows, so we're excluding it from the list of allowed characters.
2025-12-11 12:15:11 +03:00
Isaac Connor 9e7d31841e Fix SQL Vulnerability. Fixes GHSA-qm8h-3xvf-m7j3 2024-10-31 13:51:50 -04:00
Isaac Connor 7e98cf36d6 Remove requirement for id or eids. We can specify by filter now. Fix populating exportIds making sure it is an array. 2024-02-15 16:21:39 -05:00
Isaac Connor 648bd77b21 Apply validCardinal to all eids. Remove dead delete code 2024-01-27 18:33:19 -05:00
Isaac Connor 44a3a7a6a8 Fix loading event due to missing GROUP BY. Fixes event video generation. 2023-12-01 12:46:05 -05:00
Isaac Connor 44c5c3c70c Introduce new download mode that concats event videos into 1 file per monitor 2023-10-04 12:04:11 -04:00
Simpler1 18d74ed7ac (feat): Tags
fix(tag): Create tags on mobile

chore(tags): Change TagName to Name

chore(tags): eslint

chore(tags): dbFetchAll to dbQuery for removetag

chore(events): eslint (attempt 2)

feat(tags): Better handling of keyboard

fix(tags): Enter key for creating new tag

fix(tags): Don't allow space as a tag name

feat(tags): Delete tag if last assignment removed

fix(tags): Increase height of dropdown

in progress

fix(Tags): Use T.Id on the events page dropdown

fix(Tags): Remove $availableTags from events.php

chore(sql): Formatting sql statements

feat(Tags): Working OR on filters and events pages

fix(filter): Populate availableTags

chore(Tags): code formatting

fix(tag): Add tag on create tag

Fix(tags): Remove tag from available if last

feat(tags): Add zm_update.sql

fix(chosen): Undo css width

fix(chosen): tags dropdown width

fix(tags): dropdown over timeline

fix(tags): Full width input

fix(events): Refresh table on page show

chore(filter): Clean up availableTags

chore(event): Clean up available & selected Tags

fix(event): Update available tags on remove

fix(event): Remove hack for selected tags

feat(tags): Blur input after adding tag

doc(tags): Initial tags documentation

fix(tags): Dark theme dropdown

fix(tags): Dark theme for tags on input

fix(tags): Dark theme for highlight in dropdown

fix(tags): Populate filter tags droplist

chore(): Bump zm_update to 1.37.42

chore(tags): Move mobile check to skin.js

chore(tags): Comment debug statements

fix(tags): Enter key to create tag on mobile Chome

chore(tags): Space in 'All Tags' for translation

Temporary commit to handle cookie expiration times

chore(tags): Remove unnecessary Tag(s) from en_gb

chore(): Cleanup unnecessary Error and Debug

chore(): Resolve merge conflicts

chore(): Address merge conflicts with master
2023-08-31 15:50:08 -04:00
Isaac Connor 969baa3891 Convert user from an array to a User object 2023-04-23 12:57:29 -04:00
Isaac Connor 4c40ef8cfb Add transform support and use Event::createVideo 2022-09-06 13:46:54 -04:00
Isaac Connor 05a38c76ba Turn back on flat structure for video Download 2022-05-24 12:11:18 -04:00
Isaac Connor ed84b59671 remove extra , 2021-11-10 14:23:36 -05:00
Isaac Connor e7e8996060 Can export events if canView Snapshots. Event->canView will filter events that are not in a snapshot 2021-08-18 10:53:59 -04:00
Isaac Connor 1f1678064e Allow specifying export Structure to get a flat zip 2021-08-06 13:10:44 -04:00
Isaac Connor bed41ca44b Support specifying the export filename by passing the export_root 2021-08-05 13:30:52 -04:00
Isaac Connor d7680e1a44 Spacing 2020-05-23 10:15:48 -04:00
Isaac Connor 4e58a38317 use ini_set(display_errors,0) instead of turning off errors entirely so that we still log errors, just not output them instead of json. 2020-04-03 15:21:31 -04:00
Isaac Connor 1cbc75813c improve the output of the ajaxError to say what the action was and who the user was 2020-02-06 13:21:57 -05:00
Isaac Connor 547e80b1a9 Fix download and export button from events list. Fixes #2668 (#2670) 2019-07-24 12:31:43 -04:00
Isaac Connor df348c3513 lets go with reporting actual errors 2019-04-10 11:48:17 -04:00
Isaac Connor f7dfe2982b Fix deleting single events 2019-04-10 11:46:12 -04:00
Isaac Connor 84a200395e spacing and turn off errors because ajax should only return json 2019-03-20 14:25:34 -04:00
Isaac Connor 40292f3dad Add Compression flag 2018-09-07 09:08:33 -04:00
Isaac Connor e05604e4b3 Alter code style, spacing 2018-07-12 14:05:23 -04:00
Isaac Connor 639f916156 spacing 2018-07-09 09:59:03 -04:00
digital-gnome 3e7c573da5 Add download video option to events view
Creates a new popup window for downloading event video files with no directory structure in the archive
2017-12-03 14:42:07 -05:00
Isaac Connor 371b86300a Merge branch 'master' into storageareas 2017-06-08 14:23:40 -04:00
Isaac Connor 81c2216eb6 spaces/quotes 2017-06-08 13:37:26 -04:00
Isaac Connor 36ae355a2c spacing, braces 2017-06-05 15:21:07 -04:00
Isaac Connor ac8b09e89c merge some trivial updates from storageareas 2017-05-16 14:14:07 -04:00
Isaac Connor bf4bbf8b8d use object methods for event deletion. Main benefit is error message when deleting 2016-10-12 15:36:40 -04:00
Isaac Connor 1930b18100 Move the session start down to where it is actually needed so that we don't hold it open while generating videos 2016-06-07 10:38:37 -04:00
Isaac Connor 01af58018b close the session before requiring the page contents to fix the concurrency issue that exists due to using the file-backed session. 2015-04-20 13:06:34 -04:00
Isaac Connor bec58a6011 fixes WRT to db logging. I believe fixes issue #504 2014-09-26 14:43:58 -04:00
Isaac Connor ceca805b48 more updates 2013-12-17 11:07:19 -05:00
stan cfccc4b9bf Updates to event export and javascript fixes.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2814 e3e1d417-86f3-4887-817a-d78f3d33393f
2009-03-27 09:14:54 +00:00
stan 81fd3aaa41 Restructured ajax to be consistent.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2668 e3e1d417-86f3-4887-817a-d78f3d33393f
2008-10-16 16:12:23 +00:00