Skip to content

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

Merged
Germey merged 1 commit intoPython3WebSpider:masterfrom
teehooai:fix/cwe-208-timing-safe-comparison
Mar 28, 2026
Merged

fix: use constant-time comparison for auth token (CWE-208)#227
Germey merged 1 commit intoPython3WebSpider:masterfrom
teehooai:fix/cwe-208-timing-safe-comparison

Conversation

@teehooai
Copy link
Copy Markdown
Contributor

Summary

Fixes #226 — replaces timing-vulnerable == comparison with constant-time hmac.compare_digest.

Changes

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

CWE Reference

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

Found by SpiderShield security scanner

@Germey Germey merged commit dc32b04 into Python3WebSpider:master Mar 28, 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)

3 participants