A Config table made from an older zm_create.sql has every Private flag 0
until zmupdate.pl repairs it, and skin.js.php exports every non-Private value
to logged-in users. Now that loadConfig() generates a real signing key, that
export would let any user forge an administrator token. loadConfig() marks the
loaded secret Private whatever the table says, and the generating UPDATE sets
Private=1 in the table as well.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
config.php calls loadConfig() at file scope, near the top, and loadConfig()
now calls ensureAuthHashSecret(), which compares against
ZM_AUTH_HASH_SECRET_DEFAULT. The define came after that call, so any
non-empty secret not overridden in zm.conf stopped every web and API request
with "Undefined constant ZM_AUTH_HASH_SECRET_DEFAULT". Move the define up
with the other constants, and have the test check the order.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zm_create.sql is generated at build time, so every new install's Config
table holds the public shipped default secret. zmupdate.pl -f replaces
it, but the rpm %post runs -f only on upgrade, and containers or a
database created by hand from zm_create.sql never run it. Token auth
then refuses to work until the admin sets a secret.
loadConfig() now passes the secret through ensureAuthHashSecret(): a
default or empty value is replaced with bin2hex(random_bytes(32)) and
stored. The UPDATE matches the old value and the stored value is read
back, so concurrent first requests agree on one secret. A secret set in
zm.conf or conf.d is left alone.
ZM_AUTH_HASH_SECRET_DEFAULT moves from auth.php to config.php.in, which
loads first.
Tests: tests/php/test_auth_hash_secret_generate.php.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit a844cf136827d175f8dd02400c9755923bd28f1c)