-
-
Notifications
You must be signed in to change notification settings - Fork 213
Fixed support for PHP 7.2 so that Argon2 works too #8820
Conversation
|
TODO:
|
|
Ping reviewers, PR updated. |
|
|
||
| return false; | ||
| return 0 !== $info['algo']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no constant for unknown password algorithms :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not $info['algo'] > 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the same? I don't really care :D
|
Should we add a notice somewhere that |
I thought about that but to be honest, I think 99.9% of all users never changed that value. And adding a deprecation notice would mean we still need to support it but only for bcrypt and not the other algorithms (and it has to be done everywhere I now use |
|
K, agreed 🙂 |
| @@ -381,7 +381,7 @@ public function login() | |||
| // The password has been generated with crypt() | |||
| if (\Encryption::test($this->password)) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to being able to deprecate the Encryption::test() method, we could use
$info = password_get_info($this->password);
if ($info['algo'] > 0)
{here. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, wie could do that indeed. Then we can probably deprecate the whole Encryption class, can't we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, just the hashing part. Encrypting and decrypting remains untouched.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Talking about Contao 4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not (yet) have an alternative for encrypting and decrypting data in Contao 4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course we have, it's already documented? What are you talking about exactly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. The methods are deprecated without a concrete alternative. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then yes, we can deprecate the whole class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using Encryption::encrypt() has been deprecated and will no longer work in Contao 5.0. Use a third-party library such as OpenSSL or phpseclib instead. is a pretty well described alternative 😄
So everything ready here or what do you need?
|
Implemented in Contao 4.4 in contao/core-bundle@815b384. While porting the changes, I noticed that we are not using |
|
You're right, we should check and update the hash in those cases. |
|
Added in Contao 4.4 in contao/core-bundle@1e2096d. |
|
Backported in 7d1f0f1. |
|
This backport increased the minimum PHP version for Contao 3.5 from PHP 5.4.0 to PHP 5.5.0 because the |
|
We might add https://github.com/ircmaxell/password_compat. |
|
My bad, I forgot to update the |
|
Ah you meant to add ircmaxell/password_compat :) |
|
The issue has been fixed in Contao 3.5.33 (see 60893ac). |
With the release of PHP 7.2, there's a new password hashing algorithm Argon2 available. Our
Encryption::test()currently does not recognize that because it's built the wrong way around. It should not check for the ones it knows are password api compatible but check for the ones it knows are not. That ensures that we do not have to extend that check every time a new algorithm is introduced. The password api does that itself internally.I also removed all the legacy code which is handled way better by the
password-compatpolyfill so we know it behaves the same as does the core of php.I also removed the bcrypt cost configuration. PHP itself defaults to a sane cost, I see no reason why we should not go with what the responsible crypto experts recommend.
This should also go to Contao 4.4 but without the polyfill as we require a php version >= 5.5 where the password api was introduced in php.