Skip to content

Enhance Password Reset Token Security (Hash + Expiry Mechanism) #3

@Akash504-ai

Description

@Akash504-ai

Description

The current password reset implementation stores the reset token in plain text and does not enforce an expiration time.

This presents potential security risks:

  • Token misuse if database is compromised
  • Unlimited validity of reset tokens
  • Increased attack surface for replay attacks

The reset token mechanism should be improved to follow secure production standards.


Proposed Solution

  • Hash the password reset token before storing it in the database
  • Store only the hashed version
  • Add passwordResetExpires field to enforce token expiration (e.g., 15–30 minutes)
  • Validate:
    • Token matches hashed value
    • Token is not expired
  • Clear token and expiry after successful password reset

Acceptance Criteria

  • Reset token stored in hashed format
  • Expiration time implemented
  • Expired tokens rejected
  • Token invalidated after successful reset
  • No breaking changes to existing reset flow

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions