Commit Graph
29 Commits
Author SHA1 Message Date
Jash 0acd815473 fix: renaming your own user keeps the session, unposted group permissions, uid notice in user view refs #6375 2026-11-16 13:14:22 +05:30
Jash 322f312223 fix: refuse to save a user without a username refs #5838 2026-11-14 19:02:06 +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 4.6 e6ace6fcf4 feat: add AUDIT logging level for tracking administrative changes
Add a new AUDIT logging level (-5) between PANIC (-4) and NOLOG (shifted
to -6) across C++, PHP, and Perl loggers. AUDIT entries use code 'AUD'
and syslog priority LOG_NOTICE. They record who changed what, from where,
for monitors, filters, users, config, roles, groups, zones, states,
servers, storage, events, snapshots, control caps, and login/logout.

AUDIT entries have their own retention period (ZM_LOG_AUDIT_DATABASE_LIMIT,
default 1 year) separate from regular log pruning. The log pruning in
zmstats.pl and zmaudit.pl now excludes AUDIT rows from regular pruning
and prunes them independently.

Critical safety: the C++ termination logic is changed from
'if (level <= FATAL)' to 'if (level == FATAL || level == PANIC)' to
prevent AUDIT-level log calls from killing the process.

Includes db migration zm_update-1.39.1.sql to shift any stored NOLOG
config values from -5 to -6.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 18:19:20 -05:00
Isaac Connor 55df0fd8f7 Only save permissions if passed in POST. We might not be able to see all monitors, so might not exist in POST. 2024-03-05 16:33:41 -05:00
Isaac Connor 9cd048d97b Only try to set monitor_permissions for non-deleted Monitors 2024-02-29 09:19:19 -05:00
Isaac Connor 7762e882b1 Remove debug 2023-10-11 13:34:09 -04:00
Isaac Connor 3dbd68886a Reload user using zm\User object methods 2023-06-07 15:59:46 -04:00
Isaac Connor 3009c4902d Use User object find instead of raw sql 2023-05-12 15:11:40 -04:00
Isaac Connor 969baa3891 Convert user from an array to a User object 2023-04-23 12:57:29 -04:00
Isaac Connor 7ac8a47f3e Fix 500 on saving user due to incorrect scope of g. Fixes #3629 2022-11-10 17:15:39 -05:00
Isaac Connor 68bf964eec Add saving of Monitor_Permissions 2022-11-02 13:25:53 -04:00
Isaac Connor 79f5d77fab Add Permission saving to user view 2022-11-02 12:37:47 -04:00
Isaac Connor a67f89ff9e We renamed newUser to user in form elements 2022-11-02 12:36:42 -04:00
Isaac Connor 2db781ed44 Test for valid language file when saving user. 2022-02-08 14:30:53 -05:00
Isaac Connor d0adaeaabe rework user saving action to use User object. Implement a duplicate username check. Deprecate php < 5.3 due to lack of bcrypt password hashing functions. Hence deprecate the use of mysql PASSWORD() 2021-03-21 09:18:12 -04:00
Andrew Bauer 0f263407a5 make redirect conditional on previous view 2020-10-12 10:32:25 -05:00
Isaac Connor 630d9011f3 Fix redirect when saving users 2020-10-10 09:48:09 -04:00
Andrew Bauer 928fa67fce redirect to previous view after user perm changes 2020-10-01 10:45:44 -05:00
Isaac Connor 93b0552ed7 Update saving Users. Don't allow restrictions on admin user. Fix CSP violations. 2020-06-23 22:18:45 -04:00
Isaac Connor 1a87eb40bd Fixes #2841 and maintains login through password change 2020-02-19 16:55:38 -05:00
Isaac Connor 32a1ab58b5 remove use of userLogin which was removed recently 2019-09-15 12:19:35 -04:00
Pliable Pixels 98bf7800b0 remove a password log, corrected PHP version in log (#2627)
* remove a password log, corrected PHP version in log

* PHP version correction
2019-06-16 11:59:48 -04:00
Isaac Connor ba96f0709c fix saving user using password_hash 2019-05-30 09:58:54 -04:00
Isaac Connor 628760d5b9 Spacing and braces cleanup from asker's code 2019-05-29 10:29:03 -04:00
Pliable Pixels adb01c4d0e added password_compat for PHP >=5.3 <5.5 2019-05-12 13:57:25 -04:00
Pliable Pixels d7dbaf52d4 move user creation to bcrypt 2019-05-12 13:01:29 -04:00
Isaac Connor dbe9817bc8 Split actions.php into individual files per view 2019-01-04 09:26:34 -05:00