mirror of
https://github.com/bitwarden/server.git
synced 2025-04-06 21:48:12 -05:00
Fix logging filter for IpRateLimitMiddleware
This commit is contained in:
parent
58339df56c
commit
91af4e12c7
@ -59,7 +59,7 @@ namespace Bit.Api.Middleware
|
|||||||
if(blockedCount > 10)
|
if(blockedCount > 10)
|
||||||
{
|
{
|
||||||
_blockIpService.BlockIpAsync(identity.ClientIp, false);
|
_blockIpService.BlockIpAsync(identity.ClientIp, false);
|
||||||
_logger.LogDebug("Blocked " + identity.ClientIp);
|
_logger.LogInformation($"Blocked {identity.ClientIp}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -238,12 +238,13 @@ namespace Bit.Api
|
|||||||
Func<LogEvent, bool> serilogFilter = (e) =>
|
Func<LogEvent, bool> serilogFilter = (e) =>
|
||||||
{
|
{
|
||||||
var context = e.Properties["SourceContext"].ToString();
|
var context = e.Properties["SourceContext"].ToString();
|
||||||
if(e.Exception != null && e.Exception.GetType() == typeof(SecurityTokenValidationException) || e.Exception.Message == "Bad security stamp.")
|
if(e.Exception != null && (e.Exception.GetType() == typeof(SecurityTokenValidationException) ||
|
||||||
|
e.Exception.Message == "Bad security stamp."))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(context == typeof(IpRateLimitMiddleware).FullName && e.Level == LogEventLevel.Information)
|
if(context.Contains(typeof(IpRateLimitMiddleware).FullName) && e.Level == LogEventLevel.Information)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user