Files
dex/storage
Rene DekkerandGitHub 9355759813 fix(storage/kubernetes): Only wrap IPv6 addresses in brackets (#4388)
The Kubernetes client code was wrapping all IP addresses (both IPv4 and
IPv6) in square brackets when constructing the API server URL. This was
based on an incorrect assumption that IPv4 addresses in brackets are valid
in a URL.

Recent versions of Go (1.25.2 and later) have stricter URL parsing
that conforms to RFC 3986. This causes a failure when running Dex in a
Kubernetes environment where the KUBERNETES_SERVICE_HOST is an IPv4
address, leading to the error "invalid IPv6 host".

This commit changes the logic to only wrap IPv6 addresses in square
brackets. It uses `ip.To4() == nil` to reliably detect if an IP address
is IPv6 before wrapping it. This ensures that URLs are correctly
formatted for both IPv4 and IPv6 addresses, fixing the incompatibility
with newer Go versions.

Signed-off-by: Rene Dekker <rene@tigera.io>
2025-11-03 10:50:25 +01:00
..
2025-08-18 14:21:00 +02:00
2025-08-18 14:09:26 +02:00
2025-08-18 14:09:26 +02:00
2025-08-18 14:21:00 +02:00
2016-07-26 15:51:24 -07:00
2025-02-04 10:11:44 +01:00
2025-02-04 10:11:44 +01:00
2025-02-04 10:11:44 +01:00