Commit Graph
5 Commits
Author SHA1 Message Date
Nic BoetandClaude Opus 5.5 49ab7682ea fix: keep the auth relay out of PHP warnings on failed remote requests
When the other server of a multi-server install did not answer,
file_get_contents() raised a PHP warning whose text is the call and its
URL, ?auth=<hash> or user=/pass= included, and PHP wrote it to the web
server's error log (Event.php, Filter.php). The same happened with the
image proxy's digest retry (camera user:password@) and the X-Frame
check of a website monitor (get_headers()), which also took the false
it returns on failure for an array.

Fetch with @ and log lastErrorForLog(), the reason without the call
and its URL, next to urlForLog() of the URL. Server::SendToApi()
already used @ and now logs the reason too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 10:27:39 -05:00
Nic BoetandClaude Opus 5.5 5c69921e18 fix: stop logging camera credentials in the web UI
The network probe logged the camera password it was about to try and
camera URLs with user:password@ (monitor_probe.php), saving a monitor
dumped the changed fields with Pass, ONVIF_Password and the Path and
ControlAddress credentials (actions/monitor.php), the ONVIF probe logged
the failing zmonvif-probe command line, password included, at Error
level, which reaches the Logs table by default (onvifprobe.php), the CSV
camera import logged each URL at Info level (add_monitors.php), and the
image proxy logged its Digest Authorization header and the camera URL
(views/image.php).

Log user names without passwords, URLs through urlForLog() and dumps
through redactForLog(). removeUserinfo(), used by both, now also strips
a ControlAddress's scheme-less user:password@host, and ends the userinfo
at the last @ before the path: a camera password with a raw @ in it
works with cameras and ffmpeg, and its tail was left in the log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 10:27:39 -05:00
Nic BoetandClaude Opus 5.5 8ccece3ad5 fix: keep the other query parameters in logged multi-server URLs
urlForLog() dropped the whole query string, which also hid the
parameters that say what the call was (view=, action=, user=). Run the
query through redactQueryString() instead: the auth relay's password is
replaced, auth= and token= become fingerprints, the rest is kept.
redactQueryString() now also ends a value at '?', since Event.php
builds the plain relay as ?user=..?pass=...

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 10:27:39 -05:00
Nic BoetandClaude Opus 5.5 cffa439c31 fix: redact credentials from the login redirect in the debug log
An unauthenticated request is redirected to the login view with its
query string in postLoginQuery, and index.php logged that redirect at
debug level: an expired or refused auth= hash, a token= JWT or a
password= sent in the URL went into the log twice, once in the
"Redirecting to" line and once in the next request's parameter dump.

redactForLog() now also redacts query strings found inside values, and
the redirect line goes through the new redactQueryString().

Found by the web probe on the fix branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 10:27:39 -05:00
Nic BoetandClaude Opus 5.5 afc10b52a9 fix: redact credentials from the request and session debug dumps
index.php logged print_r($_REQUEST) at debug level on every request:
the login form's password in clear, auth= hashes, token= JWTs, a new
user's password from the user form and camera passwords from the
monitor form. The API's AppController logged print_r($_SESSION) on
every cookie-authenticated call: the session's auth hashes and, with
ZM_AUTH_RELAY=plain, the user's password.

Add web/includes/log_redact.php (loaded by logger.php) with
redactForLog(), which keeps the dump's shape but replaces passwords and
secrets, fingerprints tokens, auth hashes and CSRF tokens, and strips
user:password@ from URL values; urlForLog(); and logFingerprint(), the
web side of zm::crypto::LogFingerprint().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 10:27:39 -05:00