diff --git a/src/Core/IdentityServer/BaseRequestValidator.cs b/src/Core/IdentityServer/BaseRequestValidator.cs index 3daa7f9879..a4773d49cc 100644 --- a/src/Core/IdentityServer/BaseRequestValidator.cs +++ b/src/Core/IdentityServer/BaseRequestValidator.cs @@ -82,6 +82,12 @@ namespace Bit.Core.IdentityServer CustomValidatorRequestContext validatorContext) { var isBot = (validatorContext.CaptchaResponse?.IsBot ?? false); + if (isBot) + { + _logger.LogInformation(Constants.BypassFiltersEventId, + "Login attempt for {0} detected as a captcha bot with score {1}.", + request.UserName, validatorContext.CaptchaResponse.Score); + } var twoFactorToken = request.Raw["TwoFactorToken"]?.ToString(); var twoFactorProvider = request.Raw["TwoFactorProvider"]?.ToString(); diff --git a/src/Core/Models/Business/CaptchaResponse.cs b/src/Core/Models/Business/CaptchaResponse.cs index e1d791647f..c77330242f 100644 --- a/src/Core/Models/Business/CaptchaResponse.cs +++ b/src/Core/Models/Business/CaptchaResponse.cs @@ -5,5 +5,6 @@ public bool Success { get; set; } public bool MaybeBot { get; set; } public bool IsBot { get; set; } + public double Score { get; set; } } } diff --git a/src/Core/Services/Implementations/HCaptchaValidationService.cs b/src/Core/Services/Implementations/HCaptchaValidationService.cs index 5902aeec33..e88045db59 100644 --- a/src/Core/Services/Implementations/HCaptchaValidationService.cs +++ b/src/Core/Services/Implementations/HCaptchaValidationService.cs @@ -89,6 +89,7 @@ namespace Bit.Core.Services var score = hcaptchaResponse.Score.GetValueOrDefault(); response.MaybeBot = score >= _globalSettings.Captcha.MaybeBotScoreThreshold; response.IsBot = score >= _globalSettings.Captcha.IsBotScoreThreshold; + response.Score = score; return response; }