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
F15573220: D8270.id19675.diff
Mon, May 5, 7:59 PM
F15566684: D8270.diff
Thu, May 1, 10:14 PM
F15547983: D8270.id19684.diff
Sat, Apr 26, 9:01 PM
F15537895: D8270.id19676.diff
Thu, Apr 24, 4:23 PM
F15529362: D8270.id19676.diff
Tue, Apr 22, 7:05 PM
F15506706: D8270.id19675.diff
Tue, Apr 15, 1:26 PM
F15505521: D8270.id19684.diff
Tue, Apr 15, 3:46 AM
F15504964: D8270.id19677.diff
Mon, Apr 14, 10:58 PM
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.