Repository navigation
fix(user): store the hash of the email codes, reset link valid 1 day - #2830
Conversation
The codes of the registration, password reset and email change links were stored in clear: whoever read the users table could use them. Only their SHA-256 is stored now, with the purpose kept readable for the purpose checks and the purge of accounts never validated. Incoming codes must have the exact format of a sent code, so a stored hash is never accepted as a code. Codes stored in clear before this change are still accepted until they expire (3 days at most); that fallback can go after 2026-12-08. The password reset link is now valid 1 day instead of 3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
No actionable comments were generated in the recent review. WalkthroughValidation nonces are now stored as SHA-256 hashes while raw values remain available for email links. User views accept hashed and legacy cleartext nonces before expiry. Password-reset nonces expire after one day. ChangesNonce handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant UserViews
participant UserModel
participant UserStorage
participant EmailLink
UserViews->>UserModel: Create password-reset nonce
UserModel->>UserStorage: Store hashed nonce
UserModel-->>UserViews: Return raw nonce
UserViews->>EmailLink: Include raw nonce in reset link
UserViews->>UserStorage: Look up hashed or legacy nonce before expiry
Suggested reviewers: Merge Risk:
|
What
<purpose>_sha256_<digest>). The purpose stays readable, for the purpose checks and the purge of accounts never validated.Deploy
No migration. Codes stored in clear before the deploy keep working until they expire (3 days at most); the fallback for them is marked in
validate_user_from_nonceand can be removed after 2026-12-08.Tests
🤖 Generated with Claude Code
Summary by CodeRabbit