mirror of
https://github.com/bitwarden/server.git
synced 2026-02-08 01:43:15 +08:00
[PM-30563] Change error response on Send Access token request (#6911)
* feat: remove invalid email response and instead return email and OTP required to protect against enumeration attacks. * fix: fixing tests and dotnet format
This commit is contained in:
@@ -68,8 +68,8 @@ public class SendEmailOtpRequestValidatorTests
|
||||
|
||||
// Assert
|
||||
Assert.True(result.IsError);
|
||||
Assert.Equal(OidcConstants.TokenErrors.InvalidGrant, result.Error);
|
||||
Assert.Equal("email is invalid.", result.ErrorDescription);
|
||||
Assert.Equal(OidcConstants.TokenErrors.InvalidRequest, result.Error);
|
||||
Assert.Equal("email and otp are required.", result.ErrorDescription);
|
||||
|
||||
// Verify no OTP generation or email sending occurred
|
||||
await sutProvider.GetDependency<IOtpTokenProvider<DefaultOtpTokenProviderOptions>>()
|
||||
@@ -115,7 +115,7 @@ public class SendEmailOtpRequestValidatorTests
|
||||
// Assert
|
||||
Assert.True(result.IsError);
|
||||
Assert.Equal(OidcConstants.TokenErrors.InvalidRequest, result.Error);
|
||||
Assert.Equal("email otp sent.", result.ErrorDescription);
|
||||
Assert.Equal("email and otp are required.", result.ErrorDescription);
|
||||
|
||||
// Verify OTP generation
|
||||
await sutProvider.GetDependency<IOtpTokenProvider<DefaultOtpTokenProviderOptions>>()
|
||||
|
||||
Reference in New Issue
Block a user