fix: use length-check + ct_eq for constant-time auth comparison#153
fix: use length-check + ct_eq for constant-time auth comparison#153jamesadevine merged 1 commit intomainfrom
Conversation
Replace zero-padded constant-time comparison with the canonical pattern: check lengths first (non-constant-time, acceptable since length leakage doesn't help brute-force a high-entropy token), then ct_eq on equal-length slices. This avoids a theoretical null-byte false-positive in the padding approach. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🔍 Rust PR ReviewSummary: Correct fix — the null-byte false-positive in the padding approach was a real logical flaw. The new pattern is canonical and cleaner. Findings🐛 Bugs / Logic Issues
Practical exploitability caveat: ✅ What Looks Good
|
Replace zero-padded constant-time comparison with the canonical pattern: check lengths first (non-constant-time, acceptable since length leakage doesn't help brute-force a high-entropy token), then ct_eq on equal-length slices. This avoids a theoretical null-byte false-positive in the padding approach.