This repository was archived by the owner on Nov 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
MC-34097 Update supported PHP version #7255
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
8e96e1d
Update PHP version number for 2.4
dobooth 315de4e
One more change
dobooth d50ee6f
One more change
dobooth d2ae778
Merge branch 'db_php74_2.4develop' of github.com:magento/devdocs into…
dobooth 20214fc
Reverted link
dobooth c49eca5
Fixed symlinking
dobooth f15dab4
Merge branch '2.4.0-develop' into db_php74_2.4develop
dobooth a690f8f
Merge branch '2.4.0-develop' into db_php74_2.4develop
dobooth 3621cbd
Backing out 2.3 changes.
dobooth 0efb4a3
Adding composer_lock files for updated version numbers
dobooth 477ba94
Composer lock, updated liquid
dobooth ece968f
Updated data file path to 2_4
dobooth 5444a7d
Merge branch '2.4.0-develop' into db_php74_2.4develop
dobooth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
10,854 changes: 10,854 additions & 0 deletions
10,854
src/_data/codebase/v2_4/commerce/composer_lock.json
Large diffs are not rendered by default.
Oops, something went wrong.
10,854 changes: 10,854 additions & 0 deletions
10,854
src/_data/codebase/v2_4/open-source/composer_lock.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
group: configuration-guide | ||
title: Password hashing | ||
--- | ||
|
||
Currently Magento uses its own strategy for password hashing, based on different native PHP hashing algorithms. Magento supports multiple algorithms like `MD5`, `SHA256`, or `Argon 2ID13`. If the Sodium extension is installed (installed by default in PHP 7.3), then `Argon 2ID13` will be chosen as the default hashing algorithm. Otherwise, `SHA256` will be as default. Magento can use the native PHP `password_hash` function with Argon 2i algorithm support. | ||
|
||
To avoid compromising older passwords that have been hashed with outdated algorithms like `MD5`, the current implementation provides a method to upgrade the hash without changing the original password. In general, the password hash has the following format: | ||
|
||
```text | ||
password_hash:salt:version<n>:version<n> | ||
``` | ||
|
||
where `version<n>`...`version<n>` represents all the hash algorithms versions used on the password. Also, the salt is always stored together with the password hash, so we can restore the entire chain of algorithms. An example looks like: | ||
|
||
```text | ||
a853b06f077b686f8a3af80c98acfca763cf10c0e03597c67e756f1c782d1ab0:8qnyO4H1OYIfGCUb:1:2 | ||
``` | ||
|
||
The first part represents the password hash. The second, `8qnyO4H1OYIfGCUb` is the salt. The last two are the different hash algorithms: 1 is `SHA256` and 2 is `Argon 2ID13`. This means that the customer's password was originally hashed with `SHA256` and after that, the algorithm was updated with `Argon 2ID13` and the hash was re-hashed with Argon. | ||
|
||
## Upgrade hash strategy | ||
|
||
Consider what the hash upgrade mechanism looks like. Assume that originally, a password was hashed with `MD5` and then the algorithm was updated multiple times with Argon 2ID13. The following diagram shows the hash upgrade flow. | ||
|
||
 | ||
|
||
Each hash algorithm uses the previous password hash to generate a new hash. Magento does not store the original, raw password. | ||
|
||
 | ||
|
||
As discussed above, the password hash might have multiple hash versions applied to the original password. | ||
Here is how the password verification mechanism works during a customer authentication. | ||
|
||
```php | ||
def verify(password, hash): | ||
restored = password | ||
|
||
hash_map = extract(hash) | ||
# iterate through all versions specified in the received hash [md5, sha256, argon2id13] | ||
for version in hash_map.get_versions(): | ||
# generate new hash based on password/previous hash, salt and version | ||
restored = hash_func(salt . restored, version) | ||
|
||
# extract only password hash from the hash:salt:version chain | ||
hash = hash_map.get_hash() | ||
|
||
return compare(restored, hash) | ||
``` | ||
|
||
Since Magento stores all used password hashes versions together with the password hash, we can restore the whole hash chain during the password verification. The hash verification mechanism is similar to the hash upgrade strategy: based on versions stored together with the password hash, the algorithm generates hashes from the provided password and returns the comparison result between hashed password and the database stored hash. | ||
|
||
## Implementation | ||
|
||
The `\Magento\Framework\Encryption\Encryptor` class is responsible for password hash generation and verification. The [`bin/magento customer:hash:upgrade`](https://devdocs.magento.com/guides/v2.4/reference/cli/magento.html#customerhashupgrade) command upgrades a customer password hash to the latest hash algorithm. |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.