Page MenuHomePhabricator

Implement bcrypt hasher, transparent login upgrade, and explicit upgrade for passwords
ClosedPublic

Authored by epriestley on Feb 18 2014, 7:06 PM.
Tags
None
Referenced Files
F19095791: D8270.diff
Thu, Dec 4, 6:09 AM
F19055213: D8270.diff
Fri, Nov 28, 4:04 PM
F19052379: D8270.id.diff
Fri, Nov 28, 4:52 AM
F18884561: D8270.id19684.diff
Nov 7 2025, 1:30 AM
F18838761: D8270.id19676.diff
Oct 27 2025, 12:23 PM
F18835390: D8270.id.diff
Oct 26 2025, 3:34 PM
F18808114: D8270.id19684.diff
Oct 19 2025, 4:50 AM
F18808111: D8270.id19677.diff
Oct 19 2025, 4:49 AM
Subscribers

Details

Summary

Ref T4443.

  • Add a password_hash()-based bcrypt hasher if password_hash() is available.
  • When a user logs in using a password, upgrade their password to the strongest available hash format.
  • On the password settings page:
    • Warn the user if their password uses any algorithm other than the strongest one.
    • Show the algorithm the password uses.
    • Show the best available algorithm.
Test Plan

As an md5 user, viewed password settings page and saw a warning. Logged out. Logged in, got upgraded, no more warning. Changed password, verified database rehash. Logged out, logged in.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

src/infrastructure/util/password/PhabricatorIteratedMD5PasswordHasher.php
15

The output of md5() has length 32, not 40.

src/infrastructure/util/password/PhabricatorPasswordHasher.php
111–130

bcrypt has salt embedded in the hash, so we need to be slightly more clever here.

261

Fixes a bug which is only relevant now that we have two hashers.

epriestley updated this revision to Unknown Object (????).Feb 18 2014, 7:10 PM
  • Fix an issue with comparing md5 signatures.
epriestley updated this revision to Unknown Object (????).Feb 18 2014, 7:13 PM
  • Fix some envelope open/close stuff.