mirror of
https://github.com/bitwarden/server
synced 2025-12-18 09:13:19 +00:00
[PM-5938] Prevent permanent vault coruption on key-rotation with desycned vault (#4098)
* Add check to verify the vault state for rotation is not obviously desynced (empty) * Add unit test for key rotation guardrail * Move de-synced vault detection to validators * Add tests
This commit is contained in:
@@ -24,13 +24,9 @@ public class EmergencyAccessRotationValidator : IRotationValidator<IEnumerable<E
|
||||
IEnumerable<EmergencyAccessWithIdRequestModel> emergencyAccessKeys)
|
||||
{
|
||||
var result = new List<EmergencyAccess>();
|
||||
if (emergencyAccessKeys == null || !emergencyAccessKeys.Any())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
var existing = await _emergencyAccessRepository.GetManyDetailsByGrantorIdAsync(user.Id);
|
||||
if (existing == null || !existing.Any())
|
||||
if (existing == null || existing.Count == 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user