f598404d4a
Replace plain `==` on lock tokens with `subtle::ConstantTimeEq` at every token-comparison site on the WebDAV surface. Closes a reported timing side-channel (2026-09-05) in `evaluate_if_header` where an authenticated attacker could theoretically recover another user's active lock token via response-latency measurements on the `If:` header state-token comparison. Practical exploitability is marginal — the signal is tens-of-ns buried under ms-scale network jitter, ~5×10⁸ samples needed per token to average through the noise vs a default lock lifetime of 60 s to 1 h — but the fix is a five-line change with zero measurable perf cost (`subtle` is already transitive via sqlx-postgres → digest, so no new binary weight), and adopting constant-time compare on any token that gates access matches the hygiene rule the rest of the codebase already follows on password and session paths. Sites fixed: * `evaluate_if_header` — first-pass state-token scan and second-pass condition eval in `webdav_handler.rs`. * `WebdavLockService::refresh` — `!= token` mismatch check. * `WebdavLockService::release` — `== token` guard on the by_path invalidation branch. The two `WebdavLockService` sites are already gated by `self.by_token.get(token)?` — the attacker cannot reach the comparison without already presenting a valid token, so their timing surface is nil in practice. Kept constant-time anyway for callsite consistency. Sweep confirmed no other secret-adjacent `==` in production code: password verification goes through Argon2's `verify_password`, session/CSRF/DPoP jti tokens are hashmap-gated, and blob-hash equality compares two server-side values with no attacker- controlled operand. Reported-by: Abdurazzoqov Javohir <abdurazzoqovjavohir700-dev@users.noreply.github.com> Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>