cleanse rsskey from logs

This commit is contained in:
Bogdan
2025-02-05 20:09:28 +02:00
parent bce5f6d3e5
commit 8b83a1e474
2 changed files with 2 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ namespace Jackett.Common.Utils.Logging
private static readonly Regex[] _CleansingRules =
{
// Url
new Regex(@"(?<=[?&: ;])(apikey|api_key|(?:(?:access|api)[-_]?)?token|pass(?:key|wd)?|auth|authkey|user|u?id|api|[a-z_]*apikey|account|pwd)=(?<secret>[^&=""]+?)(?=[ ""&=]|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new Regex(@"(?<=[?&: ;])(apikey|api_key|(?:(?:access|api)[-_]?)?token|pass(?:key|wd)?|auth|authkey|rsskey|user|u?id|api|[a-z_]*apikey|account|pwd)=(?<secret>[^&=""]+?)(?=[ ""&=]|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new Regex(@"(?<=[?& ;])[^=]*?(_?(?<!use|get_)token|username|passwo?rd)=(?<secret>[^&=]+?)(?= |&|$|;)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new Regex(@"(?<=[?& ;])[^=]*?(pid)=(?<secret>[a-z0-9]{32}[^&=]+?)(?= |&|$|;)", RegexOptions.Compiled | RegexOptions.IgnoreCase),
new Regex(@"rss(24h)?\.torrentleech\.org/(?!rss)(?<secret>[0-9a-z]+)", RegexOptions.Compiled | RegexOptions.IgnoreCase),

View File

@@ -9,6 +9,7 @@ namespace Jackett.Test.Utils.Logging
{
[TestCase(@"WebClient(HttpWebClient2).GetResultAsync(Method: POST Url: https://some-site.org/takelogin.php PostData: {username=mySecret, password=mySecret} RawBody: )")]
[TestCase(@"WebClient(HttpWebClient2).GetResultAsync(Method: GET Url: https://www.sharewood.tv/api/2b51db35e1910123321025a12b9933d2/last-torrents?)")]
[TestCase(@"https://example.org/rss/torrents?rsskey=2b51db35e1910123321025a12b9933d2&search=")]
public void should_clean_message(string message)
{
var cleansedMessage = CleanseLogMessage.Cleanse(message);