From 4a2e3c4a9bb84e88553b0cd7c3009c1cfeb513c4 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 14 Aug 2019 03:07:24 +0200 Subject: [PATCH 1/2] Bump golang 1.11.13 (CVE-2019-9512, CVE-2019-9514) go1.11.13 (released 2019/08/13) includes security fixes to the net/http and net/url packages. See the Go 1.11.13 milestone on our issue tracker for details: https://github.com/golang/go/issues?q=milestone%3AGo1.11.13 - net/http: Denial of Service vulnerabilities in the HTTP/2 implementation net/http and golang.org/x/net/http2 servers that accept direct connections from untrusted clients could be remotely made to allocate an unlimited amount of memory, until the program crashes. Servers will now close connections if the send queue accumulates too many control messages. The issues are CVE-2019-9512 and CVE-2019-9514, and Go issue golang.org/issue/33606. Thanks to Jonathan Looney from Netflix for discovering and reporting these issues. This is also fixed in version v0.0.0-20190813141303-74dc4d7220e7 of golang.org/x/net/http2. net/url: parsing validation issue - url.Parse would accept URLs with malformed hosts, such that the Host field could have arbitrary suffixes that would appear in neither Hostname() nor Port(), allowing authorization bypasses in certain applications. Note that URLs with invalid, not numeric ports will now return an error from url.Parse. The issue is CVE-2019-14809 and Go issue golang.org/issue/29098. Thanks to Julian Hector and Nikolai Krein from Cure53, and Adi Cohen (adico.me) for discovering and reporting this issue. Signed-off-by: Sebastiaan van Stijn Upstream-commit: aed09dc7ebdd35098b20a79ce653357c0bbb5863 Component: cli --- components/cli/appveyor.yml | 2 +- components/cli/dockerfiles/Dockerfile.binary-native | 2 +- components/cli/dockerfiles/Dockerfile.cross | 2 +- components/cli/dockerfiles/Dockerfile.dev | 2 +- components/cli/dockerfiles/Dockerfile.e2e | 2 +- components/cli/dockerfiles/Dockerfile.lint | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/components/cli/appveyor.yml b/components/cli/appveyor.yml index ca41dc23bf..6bec8e00de 100644 --- a/components/cli/appveyor.yml +++ b/components/cli/appveyor.yml @@ -4,7 +4,7 @@ clone_folder: c:\gopath\src\github.com\docker\cli environment: GOPATH: c:\gopath - GOVERSION: 1.11.12 + GOVERSION: 1.11.13 DEPVERSION: v0.4.1 install: diff --git a/components/cli/dockerfiles/Dockerfile.binary-native b/components/cli/dockerfiles/Dockerfile.binary-native index 8fa5e60959..c97d8ae225 100644 --- a/components/cli/dockerfiles/Dockerfile.binary-native +++ b/components/cli/dockerfiles/Dockerfile.binary-native @@ -1,4 +1,4 @@ -FROM golang:1.11.12-alpine +FROM golang:1.11.13-alpine RUN apk add -U git bash coreutils gcc musl-dev diff --git a/components/cli/dockerfiles/Dockerfile.cross b/components/cli/dockerfiles/Dockerfile.cross index 9b9ba1368d..8127cbe907 100644 --- a/components/cli/dockerfiles/Dockerfile.cross +++ b/components/cli/dockerfiles/Dockerfile.cross @@ -1,4 +1,4 @@ -FROM dockercore/golang-cross:1.11.12 +FROM dockercore/golang-cross:1.11.13 ENV DISABLE_WARN_OUTSIDE_CONTAINER=1 WORKDIR /go/src/github.com/docker/cli COPY . . diff --git a/components/cli/dockerfiles/Dockerfile.dev b/components/cli/dockerfiles/Dockerfile.dev index 4432ad3928..412b35a6d0 100644 --- a/components/cli/dockerfiles/Dockerfile.dev +++ b/components/cli/dockerfiles/Dockerfile.dev @@ -1,4 +1,4 @@ -FROM golang:1.11.12-alpine +FROM golang:1.11.13-alpine RUN apk add -U git make bash coreutils ca-certificates curl diff --git a/components/cli/dockerfiles/Dockerfile.e2e b/components/cli/dockerfiles/Dockerfile.e2e index dd4eec0442..0a0c8af9a5 100644 --- a/components/cli/dockerfiles/Dockerfile.e2e +++ b/components/cli/dockerfiles/Dockerfile.e2e @@ -1,4 +1,4 @@ -ARG GO_VERSION=1.11.12 +ARG GO_VERSION=1.11.13 FROM docker/containerd-shim-process:a4d1531 AS containerd-shim-process diff --git a/components/cli/dockerfiles/Dockerfile.lint b/components/cli/dockerfiles/Dockerfile.lint index 8a3efd3f35..385b04be6c 100644 --- a/components/cli/dockerfiles/Dockerfile.lint +++ b/components/cli/dockerfiles/Dockerfile.lint @@ -1,4 +1,4 @@ -FROM golang:1.11.12-alpine +FROM golang:1.11.13-alpine RUN apk add -U git From 3eb1c8ac825a5068074ec4bc3a243b9f4f9c4f09 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 14 Aug 2019 10:04:43 +0200 Subject: [PATCH 2/2] Adjust tests for changes in Go 1.12.8 / 1.11.13 For now, just verifying that an error is returned, but not checking the error message itself, because those are not under our control, and may change with different Go versions. ``` === Failed === FAIL: opts TestParseDockerDaemonHost (0.00s) hosts_test.go:87: tcp tcp:a.b.c.d address expected error "Invalid bind address format: tcp:a.b.c.d" return, got "parse tcp://tcp:a.b.c.d: invalid port \":a.b.c.d\" after host" and addr hosts_test.go:87: tcp tcp:a.b.c.d/path address expected error "Invalid bind address format: tcp:a.b.c.d/path" return, got "parse tcp://tcp:a.b.c.d/path: invalid port \":a.b.c.d\" after host" and addr === FAIL: opts TestParseTCP (0.00s) hosts_test.go:129: tcp tcp:a.b.c.d address expected error Invalid bind address format: tcp:a.b.c.d return, got parse tcp://tcp:a.b.c.d: invalid port ":a.b.c.d" after host and addr hosts_test.go:129: tcp tcp:a.b.c.d/path address expected error Invalid bind address format: tcp:a.b.c.d/path return, got parse tcp://tcp:a.b.c.d/path: invalid port ":a.b.c.d" after host and addr ``` Signed-off-by: Sebastiaan van Stijn (cherry picked from commit de1523d221d7e719fe470c63c3cd908092e772df) Signed-off-by: Sebastiaan van Stijn Upstream-commit: feb68f90553b12947e010f601b985a98f6930623 Component: cli --- components/cli/opts/hosts_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/components/cli/opts/hosts_test.go b/components/cli/opts/hosts_test.go index a2b03f46d9..3e6e49703f 100644 --- a/components/cli/opts/hosts_test.go +++ b/components/cli/opts/hosts_test.go @@ -53,8 +53,8 @@ func TestParseHost(t *testing.T) { func TestParseDockerDaemonHost(t *testing.T) { invalids := map[string]string{ - "tcp:a.b.c.d": "Invalid bind address format: tcp:a.b.c.d", - "tcp:a.b.c.d/path": "Invalid bind address format: tcp:a.b.c.d/path", + "tcp:a.b.c.d": "", + "tcp:a.b.c.d/path": "", "udp://127.0.0.1": "Invalid bind address format: udp://127.0.0.1", "udp://127.0.0.1:2375": "Invalid bind address format: udp://127.0.0.1:2375", "tcp://unix:///run/docker.sock": "Invalid proto, expected tcp: unix:///run/docker.sock", @@ -83,7 +83,7 @@ func TestParseDockerDaemonHost(t *testing.T) { "localhost:5555/path": "tcp://localhost:5555/path", } for invalidAddr, expectedError := range invalids { - if addr, err := parseDockerDaemonHost(invalidAddr); err == nil || err.Error() != expectedError { + if addr, err := parseDockerDaemonHost(invalidAddr); err == nil || expectedError != "" && err.Error() != expectedError { t.Errorf("tcp %v address expected error %q return, got %q and addr %v", invalidAddr, expectedError, err, addr) } } @@ -99,8 +99,8 @@ func TestParseTCP(t *testing.T) { defaultHTTPHost = "tcp://127.0.0.1:2376" ) invalids := map[string]string{ - "tcp:a.b.c.d": "Invalid bind address format: tcp:a.b.c.d", - "tcp:a.b.c.d/path": "Invalid bind address format: tcp:a.b.c.d/path", + "tcp:a.b.c.d": "", + "tcp:a.b.c.d/path": "", "udp://127.0.0.1": "Invalid proto, expected tcp: udp://127.0.0.1", "udp://127.0.0.1:2375": "Invalid proto, expected tcp: udp://127.0.0.1:2375", } @@ -125,7 +125,7 @@ func TestParseTCP(t *testing.T) { "localhost:5555/path": "tcp://localhost:5555/path", } for invalidAddr, expectedError := range invalids { - if addr, err := ParseTCPAddr(invalidAddr, defaultHTTPHost); err == nil || err.Error() != expectedError { + if addr, err := ParseTCPAddr(invalidAddr, defaultHTTPHost); err == nil || expectedError != "" && err.Error() != expectedError { t.Errorf("tcp %v address expected error %v return, got %s and addr %v", invalidAddr, expectedError, err, addr) } }