Commit Graph
101 Commits
Author SHA1 Message Date
Isaac Connor 2fe544bc06 Merge pull request #6387 from AJ0070/fix-download-export
fix: downloads with unviewable events, mkv videos, stale archives, and export file list paths
2026-11-17 08:26:30 -05:00
Jash 7b5612873d fix: load the skin's own skin.css.php and stop export warnings and TypeError refs #6441 2026-11-16 16:32:48 +05:30
Jash 870dc80021 fix: downloads with unviewable events, mkv videos, stale archives, and export file list paths refs #6386 2026-11-16 13:42:51 +05:30
Jash 7a02fed258 fix: reset exec output before the export archive command refs #6029 2026-11-16 00:40:02 +05:30
Jash f9dfde8f33 fix: clean up export files when an export or download fails refs #5702 2026-11-15 09:48:10 +05:30
Jash 4172a62758 fix: prefix flat export file names so events don't collide refs #5710 2026-11-13 14:15:07 +05:30
Jash c4c5e2b15c fix: remove an export's working directory once its archive is built and the archive once it is downloaded fixes #5583 2026-11-12 03:36:15 +05:30
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
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
Jash 94b82f2a21 fix: keep the per-event export dir to the owner and off the flat path refs #5074 2026-09-01 07:50:15 +05:30
Jash e741d9b5bd fix: set an explicit mode on the per-event export dir fixes #5074 2026-08-30 01:35:53 +05:30
copilot-swe-agent[bot]andconnortechnology 114f41aa6b fix: add -- to cp -as commands to prevent path/flag confusion
Co-authored-by: connortechnology <925519+connortechnology@users.noreply.github.com>
2026-03-09 16:55:01 +00:00
Isaac ConnorandClaude Opus 4.6 b3a7c05f07 fix: close SQL injection, command injection, and shell escaping gaps
FilterTerm.php:
- Use intval() on AlarmedZoneId value in SQL subquery to prevent
  injection via crafted filter val

report_event_audit.php, montagereview.php:
- Cast $selected_monitor_ids through array_map('intval') before
  interpolating into SQL IN clause (values come from $_REQUEST)

download_functions.php:
- Replace manual single-quoting with escapeshellarg() for merged
  file name in ffmpeg, tar, and zip commands (monitor names can
  contain shell metacharacters including single quotes)
- Same fix for export list file path

export_functions.php:
- Use escapeshellarg() on source and destination paths in cp -as
  commands during event export

functions.php:
- Validate column keys in getFormChanges() against /^[a-zA-Z0-9_]+$/
  to prevent SQL injection via crafted array keys from $_REQUEST
- Use dbEscape() and intval() for image/document MIME type and size
  fields instead of raw string interpolation
- Replace escapeshellcmd() with escapeshellarg() in deletePath()
  rm -rf command

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 10:48:23 -04:00
Isaac ConnorandClaude Opus 4.6 605f962b7b fix: sanitize exportFile and connkey params in event export to prevent command injection
The exportFile POST parameter was passed unsanitized to exportEvents() as
$export_root, which was then interpolated directly into shell commands
executed via exec(). An authenticated user with View permissions for Events
could inject arbitrary shell commands through the exportFile parameter.

The connkey parameter had the same vulnerability.

Strip both values to safe characters (word chars, hyphens, dots) on entry
to exportEvents(), and wrap the directory argument to tar/zip with
escapeshellarg() as defense in depth.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 22:46:38 -05:00
Steve Gilvarry e389eed485 Final cleanup of videojs update 2025-12-31 19:33:54 +11:00
Steve Gilvarry f095a2eb10 Remove zoom 2025-12-31 19:33:54 +11:00
Steve Gilvarry 48096ce4f0 Remove rotation once I worked out that videowriter puts it into the mp4... 2025-12-31 19:33:54 +11:00
Steve Gilvarry 819da45ecc Fix double rotation 2025-12-31 19:33:54 +11:00
Steve Gilvarry 8760a2b79f Fix rotation strings to numeric rotation values 2025-12-31 19:33:53 +11:00
Steve Gilvarry 4463f5dcf7 Videojs not loaded when inline script called. 2025-12-31 19:33:53 +11:00
Steve Gilvarry 277cf15518 Fix Nonce and attempt text tracks fixes 2025-12-31 19:33:53 +11:00
Steve Gilvarry a71d5d9c3c Update Videojs to v8 2025-12-31 19:33:53 +11:00
Isaac Connor dd064f606a Fix two straggling array uses of user 2023-04-24 10:16:46 -04:00
Isaac Connor 8a6db4a5e7 convert event->Id() explicitly to a string for strpos. 2022-09-22 16:21:25 -04:00
Isaac Connor bd22cd7fdd Use global dateTimeFormatter to replace strftime 2022-06-01 16:17:00 -04:00
Isaac Connor 72be70f166 When using flat mode, only rename files that don't aleady include the event id. Turn off master.html if only video is being downloaded 2022-05-24 12:11:55 -04:00
Ben Dailey e4f5f59e8d 3 more img tags 2022-02-22 08:31:41 -05:00
Isaac Connor 4945a016cf Restore inclusion of video files in export when not including images. Fixes #3324 2021-11-17 11:04:28 -05:00
Isaac Connor 5f381a244f Improvements to export. Fix tar -v, should be tar --version. make table width:100% and iframe height 100%. Always show thumbnail of video. Show Id of event if no other links. generate Images frame content event if no jpegs but there is an mp4. Set timeout to infinity for generating export. Provide more feedback if it breaks. Fix ticker. 2021-10-14 17:56:02 -04:00
Isaac Connor e18f8019b0 canView takes a user object, not a string 2021-09-08 19:07:51 -04:00
Isaac Connor 7127a944a1 Use event->canView so that events in snapshots can be exported 2021-08-18 10:53:59 -04:00
Isaac Connor eecf568041 Pass exportStructure around so that it can be used to put the right filename to the jpg in the html. Fix flat zips. Fix video files being included if exportMisc is true. 2021-08-06 13:18:06 -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 f6fcc2144f jquery.js doesn't exist, so link jquery.min.js instead 2021-05-22 13:59:32 -04:00
Isaac Connor 1c10cc492b Fix StartTime to StartDateTime 2020-12-02 13:15:32 -05:00
Andrew Bauer aac47ed361 fixes to export functions 2020-12-02 12:02:24 -06:00
Isaac Connor 10c0a6617c Return Debug to a regular function to match other logging functions. Since we switched to using namespaces we no longer clash with cake_php. 2020-10-14 10:39:25 -04:00
Isaac Connor 2021f561fa Import as a global 2020-08-16 20:08:26 -04:00
Isaac Connor 2441ae2924 Improve event export a little bit. Add links to eventFrames and eventDetail html. 2020-04-03 15:34:20 -04:00
Isaac Connor ef9fbac90c Add Noscript warnings. Whitespace, improve some logic 2020-04-02 18:14:14 -04:00
Alex Porosanu 28a4bef6ba fix tar invocation for *BSD platforms
"--xform" switch is not supported by tar on BSD platforms i.e. *BSD,
MacOS, etc. As such, use "-s" switch on these platforms, with a
similar regexp.
2020-01-09 22:03:02 +02:00
Isaac Connor 2c76c12664 Fix export to include files when using DEEP scheme. Also make it more efficient 2019-12-30 22:18:55 -05:00
Isaac Connor 845f35fe00 Fix cases of check before creating dirs. Add chmod so they are only readable by web user. Fix MonitorName => Monitor->Name() 2019-12-26 15:57:25 -05:00
Isaac Connor 09b42f8b55 remove nonce from js because it is the exported html not part of the zm web ui 2019-03-20 14:27:10 -04:00
Isaac Connor 7260f823cb Merge branch 'master' into storageareas 2019-01-21 13:52:38 -05:00
Matt N a1a42345e3 More eslint fixes; eslint in php; add eslint to travis (#2419)
* Add eslint to travis.yml

* Update eslint package versions and apply new indent rules

* Enable the brace-style and block-style eslint rules

* Enable the 'curly' eslint rule

* Enable the 'keyword-spacing' eslint rule

* Enable the 'key-spacing' eslint rule

* Enable the 'object-curly-spacing' eslint rule

* Enable the 'no-new-object' eslint rule

* Only disable the no-caller eslint rule in the one affected file

* Enable the 'no-unused-vars' eslint rule for local variables

* Add linting of JS in .php files
2019-01-19 10:32:40 -05:00
Isaac Connor 552e14a971 Merge branch 'master' into storageareas 2019-01-18 10:36:59 -05:00
Matt N eef113b6a7 Convert some characters to HTML entities (#2417) 2019-01-18 10:02:48 -05:00
Matt N 6bb5aa1b87 More inline JS / nonce conversions (#2415)
* monitor.php: Add nonce and move <script> inside </body>

* export_functions.php: Untested: Add @nonce to <script>

* blank.php: Add @nonce to <script> and add to CSP enforced views

* Enforce CSP on login and privacy views

* group.php: Add nonce and move <script> inside </body>

* filter.php: Add @nonce to <script>

* Fix updateButtons argument on the filter page upon change and page load

* events.php: Add @nonce to <script>
2019-01-18 09:51:06 -05:00
Isaac Connor f49dd93b6a Merge branch 'master' into storageareas 2019-01-16 14:39:56 -05:00