mirror of
https://github.com/bitwarden/server.git
synced 2025-04-05 21:18:13 -05:00
[PM-3777[PM-3633] Update minimum KDF iterations when creating new User record (#3687)
* Updated minimum iterations on new Users to the default. * Fixed test I missed.
This commit is contained in:
parent
bac06763f5
commit
2763345e9e
@ -38,7 +38,7 @@ public class RegisterRequestModel : IValidatableObject, ICaptchaProtectedModel
|
|||||||
Email = Email,
|
Email = Email,
|
||||||
MasterPasswordHint = MasterPasswordHint,
|
MasterPasswordHint = MasterPasswordHint,
|
||||||
Kdf = Kdf.GetValueOrDefault(KdfType.PBKDF2_SHA256),
|
Kdf = Kdf.GetValueOrDefault(KdfType.PBKDF2_SHA256),
|
||||||
KdfIterations = KdfIterations.GetValueOrDefault(5000),
|
KdfIterations = KdfIterations.GetValueOrDefault(AuthConstants.PBKDF2_ITERATIONS.Default),
|
||||||
KdfMemory = KdfMemory,
|
KdfMemory = KdfMemory,
|
||||||
KdfParallelism = KdfParallelism
|
KdfParallelism = KdfParallelism
|
||||||
};
|
};
|
||||||
|
@ -55,7 +55,7 @@ public class User : ITableObject<Guid>, ISubscriber, IStorable, IStorableSubscri
|
|||||||
[MaxLength(30)]
|
[MaxLength(30)]
|
||||||
public string ApiKey { get; set; }
|
public string ApiKey { get; set; }
|
||||||
public KdfType Kdf { get; set; } = KdfType.PBKDF2_SHA256;
|
public KdfType Kdf { get; set; } = KdfType.PBKDF2_SHA256;
|
||||||
public int KdfIterations { get; set; } = 5000;
|
public int KdfIterations { get; set; } = AuthConstants.PBKDF2_ITERATIONS.Default;
|
||||||
public int? KdfMemory { get; set; }
|
public int? KdfMemory { get; set; }
|
||||||
public int? KdfParallelism { get; set; }
|
public int? KdfParallelism { get; set; }
|
||||||
public DateTime CreationDate { get; set; } = DateTime.UtcNow;
|
public DateTime CreationDate { get; set; } = DateTime.UtcNow;
|
||||||
|
@ -129,7 +129,7 @@ public class AccountsControllerTests : IDisposable
|
|||||||
var userKdfInfo = new UserKdfInformation
|
var userKdfInfo = new UserKdfInformation
|
||||||
{
|
{
|
||||||
Kdf = KdfType.PBKDF2_SHA256,
|
Kdf = KdfType.PBKDF2_SHA256,
|
||||||
KdfIterations = 5000
|
KdfIterations = AuthConstants.PBKDF2_ITERATIONS.Default
|
||||||
};
|
};
|
||||||
_userRepository.GetKdfInformationByEmailAsync(Arg.Any<string>()).Returns(Task.FromResult(userKdfInfo));
|
_userRepository.GetKdfInformationByEmailAsync(Arg.Any<string>()).Returns(Task.FromResult(userKdfInfo));
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using Bit.Core;
|
||||||
using Bit.Core.AdminConsole.Entities;
|
using Bit.Core.AdminConsole.Entities;
|
||||||
using Bit.Core.AdminConsole.Enums;
|
using Bit.Core.AdminConsole.Enums;
|
||||||
using Bit.Core.AdminConsole.Repositories;
|
using Bit.Core.AdminConsole.Repositories;
|
||||||
@ -67,7 +68,7 @@ public class IdentityServerTests : IClassFixture<IdentityApplicationFactory>
|
|||||||
var kdf = AssertHelper.AssertJsonProperty(root, "Kdf", JsonValueKind.Number).GetInt32();
|
var kdf = AssertHelper.AssertJsonProperty(root, "Kdf", JsonValueKind.Number).GetInt32();
|
||||||
Assert.Equal(0, kdf);
|
Assert.Equal(0, kdf);
|
||||||
var kdfIterations = AssertHelper.AssertJsonProperty(root, "KdfIterations", JsonValueKind.Number).GetInt32();
|
var kdfIterations = AssertHelper.AssertJsonProperty(root, "KdfIterations", JsonValueKind.Number).GetInt32();
|
||||||
Assert.Equal(5000, kdfIterations);
|
Assert.Equal(AuthConstants.PBKDF2_ITERATIONS.Default, kdfIterations);
|
||||||
AssertUserDecryptionOptions(root);
|
AssertUserDecryptionOptions(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ public class AccountsControllerTests : IDisposable
|
|||||||
var userKdfInfo = new UserKdfInformation
|
var userKdfInfo = new UserKdfInformation
|
||||||
{
|
{
|
||||||
Kdf = KdfType.PBKDF2_SHA256,
|
Kdf = KdfType.PBKDF2_SHA256,
|
||||||
KdfIterations = 5000
|
KdfIterations = AuthConstants.PBKDF2_ITERATIONS.Default
|
||||||
};
|
};
|
||||||
_userRepository.GetKdfInformationByEmailAsync(Arg.Any<string>()).Returns(Task.FromResult(userKdfInfo));
|
_userRepository.GetKdfInformationByEmailAsync(Arg.Any<string>()).Returns(Task.FromResult(userKdfInfo));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user