Files
zoneminder/scripts
Isaac Connor 8f0c016ccf fix: require ZM_AUTH_HASH_SECRET of at least 32 characters for php-jwt 7
php-jwt 7 refuses an HS256 key shorter than 32 bytes, so a hand-set
ZM_AUTH_HASH_SECRET shorter than that made every token login fail, and
HostController::login() returned a 500 from an uncaught DomainException.

- auth.php: add ZM_AUTH_HASH_SECRET_MIN_LENGTH and authHashSecretValid().
  authHashSecretIsSet() uses it, so validateToken() and the API login
  refuse a short secret with a message instead of throwing.
- Options save (actions/options.php) and the API configs edit refuse a
  new secret that is shorter than 32 characters or the shipped default.
- zmupdate.pl -f: generateAuthHashSecret() extends an existing short
  secret by repeating it until it is at least 32 characters, through the
  new ConfigData::extendAuthHashSecret(). The user's secret is kept.
- Option help text states the minimum length.

Tests: tests/php/test_auth_hash_secret_length.php checks the rule and
that it agrees with php-jwt; tests/perl/test_auth_hash_secret_extend.pl
checks the upgrade extension.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 4480b18135d736fcd87e8ed43a45e41d55688a8d)
2026-11-09 23:05:04 -05:00
..
2016-11-07 16:08:43 -05:00
2013-03-17 00:45:21 +01:00
2013-03-17 00:45:21 +01:00