From 48f9d09f4e7e3810a88a7ca0d18070ecbaad2514 Mon Sep 17 00:00:00 2001 From: Merissa Weinstein Date: Tue, 23 Jul 2024 11:44:14 -0500 Subject: [PATCH] PM-1688 | individual vault encryption: remove client version restriction (#4198) * remove server restriction code * remove client version method check for encryption --------- Co-authored-by: bnagawiecki <107435978+bnagawiecki@users.noreply.github.com> --- src/Api/Vault/Controllers/CiphersController.cs | 15 --------------- src/Core/Constants.cs | 2 -- 2 files changed, 17 deletions(-) diff --git a/src/Api/Vault/Controllers/CiphersController.cs b/src/Api/Vault/Controllers/CiphersController.cs index 5283090e66..378b0ef721 100644 --- a/src/Api/Vault/Controllers/CiphersController.cs +++ b/src/Api/Vault/Controllers/CiphersController.cs @@ -41,7 +41,6 @@ public class CiphersController : Controller private readonly ICurrentContext _currentContext; private readonly ILogger _logger; private readonly GlobalSettings _globalSettings; - private readonly Version _cipherKeyEncryptionMinimumVersion = new Version(Constants.CipherKeyEncryptionMinimumVersion); private readonly IFeatureService _featureService; private readonly IOrganizationCiphersQuery _organizationCiphersQuery; private readonly IApplicationCacheService _applicationCacheService; @@ -199,7 +198,6 @@ public class CiphersController : Controller throw new NotFoundException(); } - ValidateClientVersionForItemLevelEncryptionSupport(cipher); ValidateClientVersionForFido2CredentialSupport(cipher); var collectionIds = (await _collectionCipherRepository.GetManyByUserIdCipherIdAsync(userId, id)).Select(c => c.CollectionId).ToList(); @@ -224,7 +222,6 @@ public class CiphersController : Controller var userId = _userService.GetProperUserId(User).Value; var cipher = await _cipherRepository.GetOrganizationDetailsByIdAsync(id); - ValidateClientVersionForItemLevelEncryptionSupport(cipher); ValidateClientVersionForFido2CredentialSupport(cipher); if (cipher == null || !cipher.OrganizationId.HasValue || @@ -590,7 +587,6 @@ public class CiphersController : Controller throw new NotFoundException(); } - ValidateClientVersionForItemLevelEncryptionSupport(cipher); ValidateClientVersionForFido2CredentialSupport(cipher); var original = cipher.Clone(); @@ -939,7 +935,6 @@ public class CiphersController : Controller var existingCipher = ciphersDict[cipher.Id.Value]; - ValidateClientVersionForItemLevelEncryptionSupport(existingCipher); ValidateClientVersionForFido2CredentialSupport(existingCipher); shareCiphers.Add((cipher.ToCipher(existingCipher), cipher.LastKnownRevisionDate)); @@ -994,8 +989,6 @@ public class CiphersController : Controller throw new NotFoundException(); } - ValidateClientVersionForItemLevelEncryptionSupport(cipher); - if (request.FileSize > CipherService.MAX_FILE_SIZE) { throw new BadRequestException($"Max file size is {CipherService.MAX_FILE_SIZE_READABLE}."); @@ -1213,14 +1206,6 @@ public class CiphersController : Controller } } - private void ValidateClientVersionForItemLevelEncryptionSupport(Cipher cipher) - { - if (cipher.Key != null && _currentContext.ClientVersion < _cipherKeyEncryptionMinimumVersion) - { - throw new BadRequestException("Cannot edit item. Update to the latest version of Bitwarden and try again."); - } - } - private void ValidateClientVersionForFido2CredentialSupport(Cipher cipher) { if (cipher.Type == Core.Vault.Enums.CipherType.Login) diff --git a/src/Core/Constants.cs b/src/Core/Constants.cs index a62c839e5c..7f4fa85541 100644 --- a/src/Core/Constants.cs +++ b/src/Core/Constants.cs @@ -23,8 +23,6 @@ public static class Constants public const string Fido2KeyCipherMinimumVersion = "2023.10.0"; - public const string CipherKeyEncryptionMinimumVersion = "2024.2.0"; - /// /// Used by IdentityServer to identify our own provider. ///