Skip to content

fix(security): use constant-time comparison for client secret and OTP#569

Merged
lakhansamani merged 1 commit intomainfrom
fix/timing-safe-comparisons
Apr 4, 2026
Merged

fix(security): use constant-time comparison for client secret and OTP#569
lakhansamani merged 1 commit intomainfrom
fix/timing-safe-comparisons

Conversation

@lakhansamani
Copy link
Copy Markdown
Contributor

Summary

  • Replace != string comparison with crypto/subtle.ConstantTimeCompare for client secret verification in the OAuth token endpoint
  • Replace != string comparison with crypto/subtle.ConstantTimeCompare for OTP verification in verify_otp and reset_password flows
  • Prevents timing side-channel attacks that could allow progressive secret/OTP extraction

Files Changed

  • internal/http_handlers/token.go — client_secret comparison
  • internal/graphql/verify_otp.go — OTP comparison
  • internal/graphql/reset_password.go — OTP comparison

Test plan

  • make test-sqlite passes (no regressions)
  • Verify token endpoint still accepts valid client_secret
  • Verify OTP verification still works end-to-end

@lakhansamani lakhansamani merged commit 6558475 into main Apr 4, 2026
@lakhansamani lakhansamani deleted the fix/timing-safe-comparisons branch April 4, 2026 13:54
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.

1 participant