fix(storage/kubernetes): only bracket IPv6 literals in in-cluster API host - #78
Merged
mridulgain merged 3 commits intoSep 3, 2026
Conversation
… host
inClusterConfig() unconditionally wrapped KUBERNETES_SERVICE_HOST in
square brackets, assuming that was safe for IPv4 too. It isn't: Go's
net/url only accepts brackets around a valid IPv6 literal, so any
cluster with an IPv4 kubernetes Service ClusterIP (the common case)
fails config parsing with "invalid IP-literal" and dex crash-loops on
startup ("cannot get kubernetes version").
Bracket only when the host actually parses as a non-IPv4 IP (i.e.
IPv6); leave IPv4 addresses and hostnames unwrapped.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
srm6867
previously approved these changes
Sep 2, 2026
3 tasks
google.golang.org/grpc v1.83.0 has CVE-2026-84304, and golang.org/x/mod v0.38.0 has CVE-2026-56864/CVE-2026-56865 (a GOSUMDB transparency-log verification bypass). Bump both across all three modules (root, api/v2, examples) as flagged by the Trivy Security Scan on PR #78. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
3 tasks
mridulgain
added a commit
that referenced
this pull request
Sep 3, 2026
google.golang.org/grpc v1.83.0 has CVE-2026-84304, and golang.org/x/mod v0.38.0 has CVE-2026-56864/CVE-2026-56865 (a GOSUMDB transparency-log verification bypass). Bump both across all three modules (root, api/v2, examples) as flagged by the Trivy Security Scan on PR #78. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
…config-ipv4-bracket
srm6867
approved these changes
Sep 3, 2026
mridulgain
deleted the
private/master/mg/fix-kubernetes-inclusterconfig-ipv4-bracket
branch
September 3, 2026 05:13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
inClusterConfig()unconditionally wrappedKUBERNETES_SERVICE_HOSTin[...]. Go'snet/urlonly accepts brackets around a valid IPv6 literal, so any cluster with an IPv4kubernetesService ClusterIP (the common case) fails withinvalid IP-literaland dex crash-loops on startup (cannot get kubernetes version).formatKubernetesHost(), which brackets only actual IPv6 literals.net/urlvalidation and exposed this pre-existing bug (code unchanged since 2020).Investigation
kubectl logs ... --previous revealed:
invalid IP-literal parse error from failed to initialize storage: cannot get kubernetes version: parse "https://[10.96.0.1]:443/version"Test plan
go test ./storage/kubernetes/...url.Parsefailure for an IPv4 host locallyQA verification
Built image:
quay.io/platform9/pf9-dex:v2025.10.0-6-g19e9bf3ffrom this branch & patched the deploy,ment.Result: pod came up clean,
1/1 Running, 0 restarts (vs. 50 restarts /CrashLoopBackOffbefore).In the logs: (
kubectl logs -n test-du-ciprsmoke-5092765 -l app.kubernetes.io/name=dex --tail=100)keystonefed-idp1connector loaded: