mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-11-30 04:04:03 -05:00
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)