lastuser icon indicating copy to clipboard operation
lastuser copied to clipboard

Switch from md5sum to sha256

Open jace opened this issue 9 years ago • 1 comments

The UserEmail and UserEmailClaim fields store a md5sum hash with a unique constraint. However, md5sum is not safe anymore and a (small) risk of collision exists. We need to use sha256 instead.

However, md5sum is still required for external services like Gravatar, so we can't just remove it. We need to instead:

  1. Add sha256 column, populate it, change it to a required field with unique constraint (migration)
  2. Remove the unique constraint on md5sum, using just an index now, and
  3. Update code everywhere to use sha256 instead of md5sum.

jace avatar Feb 05 '16 09:02 jace

To ensure old email verify and reset links continue working, the two views need to look for a match in both columns. The hashes have different lengths (IIRC) so there's no chance of a mismatch.

jace avatar Feb 05 '16 09:02 jace