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.