From 612d3655fa3eae0a8e133710142bf8ff199b59f1 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Mon, 20 Apr 2026 11:27:56 +0000 Subject: [PATCH] fix: improve IP normalization in normalizeIPOrCIDR function Co-authored-by: Copilot --- backend/internal/services/crowdsec_whitelist_service.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/internal/services/crowdsec_whitelist_service.go b/backend/internal/services/crowdsec_whitelist_service.go index 8d89c3ba..d27b0bed 100644 --- a/backend/internal/services/crowdsec_whitelist_service.go +++ b/backend/internal/services/crowdsec_whitelist_service.go @@ -149,10 +149,12 @@ func normalizeIPOrCIDR(raw string) (string, error) { _ = ip return network.String(), nil } - if net.ParseIP(raw) == nil { + ip := net.ParseIP(raw) + if ip == nil { return "", fmt.Errorf("invalid IP: %q", raw) } - return raw, nil + + return ip.String(), nil } // buildWhitelistYAML constructs the YAML content for the CrowdSec whitelist parser.