From 657c5428d6f50fc4a94613ccb78a1243fe375e8e Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 29 Jun 2025 21:40:19 -0700 Subject: [PATCH] Don't log debug messages for API key validation Closes #7934 --- src/NzbDrone.Common/Instrumentation/NzbDroneLogger.cs | 1 + src/NzbDrone.Host/Startup.cs | 2 +- .../Authentication/UiAuthorizationPolicyProvider.cs | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/NzbDrone.Common/Instrumentation/NzbDroneLogger.cs b/src/NzbDrone.Common/Instrumentation/NzbDroneLogger.cs index b9428212e..72077efb2 100644 --- a/src/NzbDrone.Common/Instrumentation/NzbDroneLogger.cs +++ b/src/NzbDrone.Common/Instrumentation/NzbDroneLogger.cs @@ -215,6 +215,7 @@ namespace NzbDrone.Common.Instrumentation c.ForLogger("Microsoft.*").WriteToNil(LogLevel.Warn); c.ForLogger("Microsoft.Hosting.Lifetime*").WriteToNil(LogLevel.Info); c.ForLogger("Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware").WriteToNil(LogLevel.Fatal); + c.ForLogger("Sonarr.Http.Authentication.ApiKeyAuthenticationHandler").WriteToNil(LogLevel.Info); }); } diff --git a/src/NzbDrone.Host/Startup.cs b/src/NzbDrone.Host/Startup.cs index a3816d946..2282f95f4 100644 --- a/src/NzbDrone.Host/Startup.cs +++ b/src/NzbDrone.Host/Startup.cs @@ -54,7 +54,7 @@ namespace NzbDrone.Host b.ClearProviders(); b.SetMinimumLevel(LogLevel.Trace); b.AddFilter("Microsoft.AspNetCore", LogLevel.Warning); - b.AddFilter("Sonarr.Http.Authentication", LogLevel.Information); + b.AddFilter("Sonarr.Http.Authentication.ApiKeyAuthenticationHandler", LogLevel.Information); b.AddFilter("Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager", LogLevel.Error); b.AddNLog(); }); diff --git a/src/Sonarr.Http/Authentication/UiAuthorizationPolicyProvider.cs b/src/Sonarr.Http/Authentication/UiAuthorizationPolicyProvider.cs index 50f1c3ada..ef5ac71ff 100644 --- a/src/Sonarr.Http/Authentication/UiAuthorizationPolicyProvider.cs +++ b/src/Sonarr.Http/Authentication/UiAuthorizationPolicyProvider.cs @@ -8,7 +8,7 @@ namespace NzbDrone.Http.Authentication { public class UiAuthorizationPolicyProvider : IAuthorizationPolicyProvider { - private const string POLICY_NAME = "UI"; + private const string PolicyName = "UI"; private readonly IConfigFileProvider _config; public DefaultAuthorizationPolicyProvider FallbackPolicyProvider { get; } @@ -26,7 +26,7 @@ namespace NzbDrone.Http.Authentication public Task GetPolicyAsync(string policyName) { - if (policyName.Equals(POLICY_NAME, StringComparison.OrdinalIgnoreCase)) + if (policyName.Equals(PolicyName, StringComparison.OrdinalIgnoreCase)) { var policy = new AuthorizationPolicyBuilder(_config.AuthenticationMethod.ToString()) .AddRequirements(new BypassableDenyAnonymousAuthorizationRequirement());