Opus finding
Webhook authorization compares Buffers of mismatched length to timingSafeEqual — but the early-exit on length leaks token length
- apps/web/app/api/cron/review-retry/route.ts:24-32
The length-mismatch short-circuit is necessary because timingSafeEqual throws on mismatched lengths, but it reveals via response timing whether the attacker's token has the correct length. For a fixed-length secret this is a minor information leak. Not critical, but worth noting because the rest of the comparison is otherwise constant-time. Mitigated by the fact that CRON_SECRET length is fixed and known to the operator; attackers gain at most knowledge of secret length.
Recommendation
Optionally pad the provided header to expected length before timingSafeEqual to fully mask length differences, e.g. compare hashes of both strings instead.