From e29d98aadb6557921e5d509f3b967e3262f22cb9 Mon Sep 17 00:00:00 2001 From: Nick Cabatoff Date: Wed, 23 Aug 2023 11:05:03 -0400 Subject: [PATCH] Work around issue with UNIX domain sockets in api.Client addresses (#22523) The Host part of the URL doesn't actually get used when we initiate connections to UNIX domain sockets. As of https://github.com/golang/go/issues/60374 (in the latest Go releases at the time of this writing), we must set it to something that looks like a hostname or requests will fail. --- api/client.go | 2 +- changelog/22523.txt | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelog/22523.txt diff --git a/api/client.go b/api/client.go index 0fa00c617e735..1ba9da48eae12 100644 --- a/api/client.go +++ b/api/client.go @@ -545,7 +545,7 @@ func (c *Config) ParseAddress(address string) (*url.URL, error) { // be pointing to the protocol used in the application layer and not to // the transport layer. Hence, setting the fields accordingly. u.Scheme = "http" - u.Host = socket + u.Host = "localhost" u.Path = "" } else { return nil, fmt.Errorf("attempting to specify unix:// address with non-transport transport") diff --git a/changelog/22523.txt b/changelog/22523.txt new file mode 100644 index 0000000000000..e53ab652b2e56 --- /dev/null +++ b/changelog/22523.txt @@ -0,0 +1,3 @@ +```release-note:bug +api: Fix breakage with UNIX domain socket addresses introduced by newest Go versions as a security fix. +```