Allow applying unicode normalisation to passwords before hashing

This commit is contained in:
Quentin Gliech
2025-05-30 15:33:34 +02:00
parent b229cb8018
commit 40cb052d1f
18 changed files with 128 additions and 56 deletions
+2 -2
View File
@@ -199,9 +199,9 @@ pub async fn synapse_config_check_against_mas_config(
// Look for the MAS password hashing scheme that will be used for imported
// Synapse passwords, then check the configuration matches so that Synapse
// passwords will be compatible with MAS.
if let Some((_, algorithm, _, secret)) = mas_password_schemes
if let Some((_, algorithm, _, secret, _)) = mas_password_schemes
.iter()
.find(|(version, _, _, _)| *version == MIGRATED_PASSWORD_VERSION)
.find(|(version, _, _, _, _)| *version == MIGRATED_PASSWORD_VERSION)
{
if algorithm != &PasswordAlgorithm::Bcrypt {
errors.push(CheckError::PasswordSchemeNotBcrypt);
@@ -179,6 +179,7 @@ impl Config {
cost: self.bcrypt_rounds,
secret: self.password_config.pepper,
secret_file: None,
unicode_normalization: true,
},
// Use the default algorithm MAS uses as a second hashing scheme, so that users
// will get their password hash upgraded to a more modern algorithm over time
@@ -188,6 +189,7 @@ impl Config {
cost: None,
secret: None,
secret_file: None,
unicode_normalization: false,
},
];