From f4346c35c2d3a7b65b36d5f79726f9e762480830 Mon Sep 17 00:00:00 2001 From: Qstick Date: Wed, 26 May 2021 23:08:01 -0400 Subject: [PATCH] Fixed: Clean apikey when in xml response with escaped & --- .../InstrumentationTests/CleanseLogMessageFixture.cs | 3 +++ src/NzbDrone.Common/Instrumentation/CleanseLogMessage.cs | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Common.Test/InstrumentationTests/CleanseLogMessageFixture.cs b/src/NzbDrone.Common.Test/InstrumentationTests/CleanseLogMessageFixture.cs index 67d48a869..19252e2d3 100644 --- a/src/NzbDrone.Common.Test/InstrumentationTests/CleanseLogMessageFixture.cs +++ b/src/NzbDrone.Common.Test/InstrumentationTests/CleanseLogMessageFixture.cs @@ -57,6 +57,9 @@ namespace NzbDrone.Common.Test.InstrumentationTests // Notifiarr [TestCase("https://notifiarr.com/notifier.php: api=1234530f-422f-4aac-b6b3-01233210aaaa&radarr_health_issue_message=Download")] + // RSS + [TestCase(@"")] + public void should_clean_message(string message) { var cleansedMessage = CleanseLogMessage.Cleanse(message); diff --git a/src/NzbDrone.Common/Instrumentation/CleanseLogMessage.cs b/src/NzbDrone.Common/Instrumentation/CleanseLogMessage.cs index 3a8e67bdf..fd7425804 100644 --- a/src/NzbDrone.Common/Instrumentation/CleanseLogMessage.cs +++ b/src/NzbDrone.Common/Instrumentation/CleanseLogMessage.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using System.Net; using System.Text.RegularExpressions; @@ -11,7 +11,7 @@ namespace NzbDrone.Common.Instrumentation private static readonly Regex[] CleansingRules = new[] { // Url - new Regex(@"(?<=\?|&|: )(apikey|token|passkey|auth|authkey|user|uid|api|[a-z_]*apikey|account|passwd)=(?[^&=]+?)(?= |&|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase), + new Regex(@"(?<=\?|&|: |;)(apikey|token|passkey|auth|authkey|user|uid|api|[a-z_]*apikey|account|passwd)=(?[^&=]+?)(?= |&|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase), new Regex(@"(?<=\?|&)[^=]*?(username|password)=(?[^&=]+?)(?= |&|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase), new Regex(@"torrentleech\.org/(?!rss)(?[0-9a-z]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase), new Regex(@"torrentleech\.org/rss/download/[0-9]+/(?[0-9a-z]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase),