mirror of
https://github.com/bitwarden/server
synced 2026-02-12 06:23:28 +00:00
[PM-31684] Remove email hashing for send access (#6945)
* [PM-31684] Remove email hashing for send access * [PM-31684] switching the order of migration files * [PM-31684] adding more migrations * [PM-31684] Removing anon access emails field and reusing emails field * [PM-31684] cleanup before adding migrations back * [PM-31684] restore original snapshots * [PM-31684] restore original postgres snapshots * [PM-31684] adding migrations * [PM-31684] removing encryption attributes from emails request model * [PM-31684] adding missing stored proc alters * [PM-31684] Improved formatting for stored proc defs * [PM-31684] adding necessary comment back * [PM-31684] adding case-insensitive check on the server for send auth
This commit is contained in:
@@ -5,7 +5,6 @@ using Bit.Core.Tools.Models.Data;
|
||||
using Bit.Identity.IdentityServer.RequestValidators.SendAccess;
|
||||
using Bit.Test.Common.AutoFixture;
|
||||
using Bit.Test.Common.AutoFixture.Attributes;
|
||||
using Bit.Test.Common.Helpers;
|
||||
using Duende.IdentityModel;
|
||||
using Duende.IdentityServer.Validation;
|
||||
using NSubstitute;
|
||||
@@ -106,8 +105,7 @@ public class SendEmailOtpRequestValidatorTests
|
||||
expectedUniqueId)
|
||||
.Returns(generatedToken);
|
||||
|
||||
var emailHash = CryptographyHelper.HashAndEncode(email);
|
||||
emailOtp = emailOtp with { EmailHashes = [emailHash] };
|
||||
emailOtp = emailOtp with { emails = [email] };
|
||||
|
||||
// Act
|
||||
var result = await sutProvider.Sut.ValidateRequestAsync(context, emailOtp, sendId);
|
||||
@@ -146,8 +144,7 @@ public class SendEmailOtpRequestValidatorTests
|
||||
Request = tokenRequest
|
||||
};
|
||||
|
||||
var emailHash = CryptographyHelper.HashAndEncode(email);
|
||||
emailOtp = emailOtp with { EmailHashes = [emailHash] };
|
||||
emailOtp = emailOtp with { emails = [email] };
|
||||
|
||||
sutProvider.GetDependency<IOtpTokenProvider<DefaultOtpTokenProviderOptions>>()
|
||||
.GenerateTokenAsync(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<string>())
|
||||
@@ -182,8 +179,7 @@ public class SendEmailOtpRequestValidatorTests
|
||||
Request = tokenRequest
|
||||
};
|
||||
|
||||
var emailHash = CryptographyHelper.HashAndEncode(email);
|
||||
emailOtp = emailOtp with { EmailHashes = [emailHash] };
|
||||
emailOtp = emailOtp with { emails = [email] };
|
||||
|
||||
var expectedUniqueId = string.Format(SendAccessConstants.OtpToken.TokenUniqueIdentifier, sendId, email);
|
||||
|
||||
@@ -235,8 +231,7 @@ public class SendEmailOtpRequestValidatorTests
|
||||
Request = tokenRequest
|
||||
};
|
||||
|
||||
var emailHash = CryptographyHelper.HashAndEncode(email);
|
||||
emailOtp = emailOtp with { EmailHashes = [emailHash] };
|
||||
emailOtp = emailOtp with { emails = [email] };
|
||||
|
||||
var expectedUniqueId = string.Format(SendAccessConstants.OtpToken.TokenUniqueIdentifier, sendId, email);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user