From 4475649bdc4812dbdf5d9d77457276c94c3737d1 Mon Sep 17 00:00:00 2001 From: Patrick Pimentel Date: Tue, 30 Dec 2025 16:06:59 -0500 Subject: [PATCH] fix(register): [PM-27084] Account Register Uses New Data Types - Removed invalid check. --- .../Accounts/RegisterFinishRequestModel.cs | 3 --- .../MasterPasswordUnlockDataRequestModel.cs | 27 ------------------- .../Data/MasterPasswordAuthenticationData.cs | 6 ----- 3 files changed, 36 deletions(-) diff --git a/src/Core/Auth/Models/Api/Request/Accounts/RegisterFinishRequestModel.cs b/src/Core/Auth/Models/Api/Request/Accounts/RegisterFinishRequestModel.cs index 1379fc30fc..c49acb3a49 100644 --- a/src/Core/Auth/Models/Api/Request/Accounts/RegisterFinishRequestModel.cs +++ b/src/Core/Auth/Models/Api/Request/Accounts/RegisterFinishRequestModel.cs @@ -113,9 +113,6 @@ public class RegisterFinishRequestModel : IValidatableObject public IEnumerable Validate(ValidationContext validationContext) { - // PM-28143 - Remove line below - MasterPasswordUnlockDataRequestModel.ThrowIfExistsAndNotMatchingAuthenticationData(MasterPasswordAuthentication, MasterPasswordUnlock); - // PM-28143 - Remove line below MasterPasswordAuthenticationDataRequestModel.ThrowIfExistsAndHashIsNotEqual(MasterPasswordAuthentication, MasterPasswordHash); diff --git a/src/Core/KeyManagement/Models/Api/Request/MasterPasswordUnlockDataRequestModel.cs b/src/Core/KeyManagement/Models/Api/Request/MasterPasswordUnlockDataRequestModel.cs index a4baf01a19..9b4e9599d3 100644 --- a/src/Core/KeyManagement/Models/Api/Request/MasterPasswordUnlockDataRequestModel.cs +++ b/src/Core/KeyManagement/Models/Api/Request/MasterPasswordUnlockDataRequestModel.cs @@ -19,31 +19,4 @@ public class MasterPasswordUnlockDataRequestModel Salt = Salt }; } - - public static void ThrowIfExistsAndNotMatchingAuthenticationData( - MasterPasswordAuthenticationDataRequestModel? authenticationData, - MasterPasswordUnlockDataRequestModel? unlockData) - { - if (unlockData != null && authenticationData != null) - { - var matches = MatchesAuthenticationData( - unlockData, - authenticationData); - - if (!matches) - { - throw new Exception("KDF settings and salt must match between authentication and unlock data."); - } - } - } - - private static bool MatchesAuthenticationData( - MasterPasswordUnlockDataRequestModel unlockData, - MasterPasswordAuthenticationDataRequestModel authenticationData) - { - var kdfMatches = unlockData.Kdf.Equals(authenticationData.Kdf); - var saltMatches = unlockData.Salt == authenticationData.Salt; - - return kdfMatches && saltMatches; - } } diff --git a/src/Core/KeyManagement/Models/Data/MasterPasswordAuthenticationData.cs b/src/Core/KeyManagement/Models/Data/MasterPasswordAuthenticationData.cs index 25b864f0bd..1bc7006cef 100644 --- a/src/Core/KeyManagement/Models/Data/MasterPasswordAuthenticationData.cs +++ b/src/Core/KeyManagement/Models/Data/MasterPasswordAuthenticationData.cs @@ -3,12 +3,6 @@ using Bit.Core.Exceptions; namespace Bit.Core.KeyManagement.Models.Data; -/// -/// The data used for authentication of a master password. -/// -/// This data model does not have any validation, consider using MasterPasswordAuthenticationDataRequestModel -/// if validation is required. -/// public class MasterPasswordAuthenticationData { public required KdfSettings Kdf { get; init; }