From c6936e2789b6cb50acea27d9f802791d7e0958c0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 28 Dec 2025 09:08:43 +0000 Subject: [PATCH 1/3] Initial plan From a99003df59aa2fce0b3c95c73890baa8e3e3c39e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 28 Dec 2025 09:11:11 +0000 Subject: [PATCH 2/3] Add prefix length validation for IPv4 (0-32) and IPv6 (0-128) CIDR ranges Co-authored-by: devnomadic <14085319+devnomadic@users.noreply.github.com> --- cloudflare-worker.template.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cloudflare-worker.template.js b/cloudflare-worker.template.js index a61cb1f..b97a92e 100644 --- a/cloudflare-worker.template.js +++ b/cloudflare-worker.template.js @@ -1008,6 +1008,21 @@ function isIpInRange(ip, cidrRange) { const isIPv6 = ip.includes(':'); const isRangeIPv6 = rangeIp.includes(':'); + // Validate prefix length based on IP version + if (isRangeIPv6) { + // IPv6: prefix must be 0-128 + if (prefix < 0 || prefix > 128) { + console.error('Invalid IPv6 prefix length:', prefix, '(must be 0-128) in', cidrRange); + return false; + } + } else { + // IPv4: prefix must be 0-32 + if (prefix < 0 || prefix > 32) { + console.error('Invalid IPv4 prefix length:', prefix, '(must be 0-32) in', cidrRange); + return false; + } + } + // IP versions must match if (isIPv6 !== isRangeIPv6) { return false; From f09e0c9183d5dae886f9e1f78ab755ce738aabac Mon Sep 17 00:00:00 2001 From: Drew Kennedy Date: Sun, 28 Dec 2025 20:19:24 +1100 Subject: [PATCH 3/3] Fix whitespace formatting in AbuseIPDBService.cs --- Services/AbuseIPDBService.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Services/AbuseIPDBService.cs b/Services/AbuseIPDBService.cs index 9dee50f..f37db47 100644 --- a/Services/AbuseIPDBService.cs +++ b/Services/AbuseIPDBService.cs @@ -472,16 +472,16 @@ public async Task CheckIPAsync(string ipAddress, int maxAg // Build request URL with optional cloudprovider parameter var requestUrl = $"{_cloudflareWorkerUrl}?ipAddress={actualIpAddress}&maxAgeInDays={actualMaxAgeInDays}&verbose={verboseParam}&enableAI={enableAIParam}"; - + // Add cloudprovider parameter if specified (lowercase to match worker) if (!string.IsNullOrEmpty(cloudProvider)) { requestUrl += $"&cloudprovider={cloudProvider.ToLower()}"; } - + // Add timestamp requestUrl += $"×tamp={timestamp}"; - + // Normalize to lowercase for HMAC requestUrl = requestUrl.ToLower(); Console.WriteLine($"Requesting: {requestUrl}");