Commit Graph
2 Commits
Author SHA1 Message Date
Nic Boet c687bddf5a test: stub logFingerprint() for getAuthUser() in the auth hash compare test
getAuthUser() logs a fingerprint of the auth hash instead of the hash
(ZM\logFingerprint() from log_redact.php). The test evaluates
getAuthUser() in its own namespace with stub loggers, so it needs that
function stubbed too.
2026-11-01 10:28:15 -05:00
Nic BoetandClaude Opus 5.5 16ffaa5384 fix: compare the auth hash with hash_equals() in getAuthUser()
getAuthUser() compared the auth= hash a client presents with the one it
builds using ==. When both strings look like numbers PHP compares them as
numbers, so a computed md5 of the form 0e<digits> equalled any other
0e<digits> string (and "00"), and == also returns at the first byte that
differs. hash_equals() compares the bytes in constant time.

A hash of that form comes up about once in 3*10^8 user-hours, so this is
hardening; ordinary hashes compare exactly as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 18:57:14 -05:00