Skip to content

Fix: Use strong key for sign-in email link#1468

Merged
mattwoberts merged 1 commit intomainfrom
fix/signin-verification-key
Mar 4, 2026
Merged

Fix: Use strong key for sign-in email link#1468
mattwoberts merged 1 commit intomainfrom
fix/signin-verification-key

Conversation

@mattwoberts
Copy link
Contributor

@mattwoberts mattwoberts commented Mar 4, 2026

Fixes #1458

Summary

  • The sign-in email link previously used the same 6-digit numeric code as the manual entry flow, making it brute-forceable (only 1,000,000 possible values, no email required for the link flow)
  • Now generates a separate 64-char cryptographic link_key for the email URL, while keeping the 6-digit code for manual entry (which requires the email address, limiting the attack surface)
  • Makes the 6-digit code single-use — reuse now returns a 400 error instead of allowing re-authentication

Test plan

  • make lint passes
  • All existing tests updated and passing
  • New test added: TestVerifySignInCodeHandler_AlreadyVerifiedCode_ShouldReject
  • Run make migrate to apply the new code column migration
  • Manual: trigger sign-in, verify email link uses a long key, verify 6-digit code works for manual entry
  • Manual: verify that reusing a 6-digit code after successful sign-in is rejected

🤖 Generated with Claude Code

…manual entry

The sign-in email link previously used the same 6-digit numeric code as
the manual entry flow, making it brute-forceable. Now generates a separate
64-char cryptographic link_key for the email URL while keeping the 6-digit
code for manual entry (which requires the email address, limiting attack
surface). Also makes the 6-digit code single-use — reuse returns 400
instead of allowing re-authentication.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mattwoberts mattwoberts merged commit 7c88c25 into main Mar 4, 2026
14 of 16 checks passed
@mattwoberts mattwoberts deleted the fix/signin-verification-key branch March 4, 2026 20:02
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.

Potential of abuse in sign-in url

1 participant