Commit Graph
3 Commits
Author SHA1 Message Date
Isaac ConnorandClaude Opus 5.5 49c616cc0b fix(deps): update web/vendor to php-jwt 7.2.1 and port JWT::decode to Key
web/vendor still shipped firebase/php-jwt 5.0.0 although composer.json
requires ^7.0 and composer.lock pinned 7.0.0: the lock had been bumped
without regenerating vendor. Run composer update firebase/php-jwt
(7.0.0 -> 7.2.1) and commit the regenerated vendor tree.

php-jwt 6 changed JWT::decode() to take a Key instead of a key and an
array of allowed algorithms, so validateToken() moves to
JWT::decode($token, new Key($key, 'HS256')). Without that every token
would fail to decode. JWT::encode() keeps its signature.

php-jwt 7 also refuses HMAC keys shorter than the hash, which the
preceding ZM_AUTH_HASH_SECRET commits handle, and requires PHP 8.0;
composer's platform_check.php now reports an older PHP at autoload.

Tests: tests/php/test_jwt_vendor.php round trips a token the way
HostController and validateToken() do, refuses a wrong secret, an
expired token and alg none, and fails if any JWT::decode() call uses
the v5 signature, in the web code or these tests.
test_zmu_credentials.php moves to the Key form and a 32 byte secret.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 23:05:05 -05:00
Nic Boet 46ccb7529f fix: without a token secret, zmu still gets an API request's own password
When ZM_AUTH_HASH_SECRET is unusable zmu refuses tokens, so
zmuCredentials() falls back to what zmu got before. With
ZM_AUTH_RELAY=plain the API's alarm action used to pass the password
from the request (pass= or password=); the fallback read only the
session, which an API call without a stateful login doesn't have, so
zmu refused the call (rc 255). zmuCredentials() takes the caller's
password first again. With a usable secret it is never used.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 5ca19c2703ea9211fe040991305ce9b0a873faff)
2026-10-30 19:30:28 -04:00
Nic Boet 35e36e4dda fix: give zmu a short-lived token instead of the password or auth hash
getZmuCommand() and the API's alarm action put the user's credentials on
zmu's command line, where every local user can read them (ps,
/proc/<pid>/cmdline): an auth hash with the default hashed relay, the
plaintext password with ZM_AUTH_RELAY=plain. The API also wrote the
whole command to the debug log. With the default ZM_AUTH_HASH_IPS=0 that
hash is accepted as an auth= login from any address for ZM_AUTH_HASH_TTL
hours.

zmuCredentials() builds them in one place: with a usable
ZM_AUTH_HASH_SECRET, an access token for the user that expires after a
minute (zmu -T, accepted with every relay). Without the secret zmu
refuses tokens, so it gets what it did before. The API logs the command
without the credentials.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 32bc2b3fee87b752590ba6f210403afd9222d9ff)
2026-10-30 19:30:27 -04:00