Skip to content

fix: use constant-time comparison for auth token (CWE-208)#307

Closed
teehooai wants to merge 1 commit intodjyde:masterfrom
teehooai:fix/cwe-208-timing-safe-comparison
Closed

fix: use constant-time comparison for auth token (CWE-208)#307
teehooai wants to merge 1 commit intodjyde:masterfrom
teehooai:fix/cwe-208-timing-safe-comparison

Conversation

@teehooai
Copy link
Copy Markdown

Summary

Fixes #306 — replaces timing-vulnerable === comparison with constant-time timingSafeEqual.

Changes

  • Replace direct string comparison with constant-time comparison for admin password
  • No behavioral change for valid authentication flows

CWE Reference

  • CWE-208: Observable Timing Discrepancy
  • Uses stdlib only (crypto) — no new dependencies

Found by SpiderShield security scanner

@teehooai
Copy link
Copy Markdown
Author

teehooai commented Apr 3, 2026

Superseded by #310 (submitted from correct account spidershield-contrib)

@teehooai teehooai closed this Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security: timing attack in auth token comparison (CWE-208)

2 participants