? Pending

User tests: Successful: Unsuccessful:

avatar mbabker
mbabker
8 Aug 2017

Summary of Changes

PHP 7.2 introduces support for a new native password hashing algorithm based on Argon2 (see https://wiki.php.net/rfc/argon2_password_hash for the relevant RFC). Since the native password API now supports multiple algorithms, the use of PASSWORD_DEFAULT is a little more flaky since conceivably one day PHP core could change this to point to a different hash. Therefore, this PR does a few things.

  1. Changes PASSWORD_DEFAULT uses to the explicit PASSWORD_BCRYPT constant instead
  2. Makes the check for the hash prefix for bcrypt hashed passwords in Joomla\CMS\User\UserHelper::verifyPassword() a little more strict
  3. Adds logic into Joomla\CMS\User\UserHelper::verifyPassword() to detect Argon2 passwords and attempt to validate them (officially, we aren't going to advertise this as a supported password hash and no part of the core API will support generating Argon2 hashes, BUT, if someone running PHP 7.2 chooses to compile it with support for the hash and implement some handling to put Argon2 hashes in their database, we can validate it since the native PHP API will handle it)

Testing Instructions

Generating password hashes still results in a valid bcrypt hash, users can still authenticate correctly.

avatar joomla-cms-bot joomla-cms-bot - change - 8 Aug 2017
Category Libraries
avatar mbabker mbabker - open - 8 Aug 2017
avatar mbabker mbabker - change - 8 Aug 2017
Status New Pending
avatar wilsonge
wilsonge - comment - 9 Aug 2017

Given we aren't doing polyfills should we add a version check on the verify method?

avatar mbabker
mbabker - comment - 9 Aug 2017

I don't think it'll be necessary. Looking at the C code for password_verify() in PHP 5.5 (where it was first introduced) and 7.2, and Anthony's polyfill, it all pushes into the crypt() PHP function (and uses a C level function for the heavy lifting) and that looks like will fail out if it doesn't recognize the salt.

avatar wilsonge wilsonge - close - 23 Aug 2017
avatar wilsonge wilsonge - merge - 23 Aug 2017
avatar wilsonge wilsonge - change - 23 Aug 2017
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-08-23 13:27:47
Closed_By wilsonge
Labels Added: ?

Add a Comment

Login with GitHub to post a comment