update to go1.19.6
go1.19.6 (released 2023-02-14) includes security fixes to the crypto/tls,
mime/multipart, net/http, and path/filepath packages, as well as bug fixes to
the go command, the linker, the runtime, and the crypto/x509, net/http, and
time packages. See the Go 1.19.6 milestone on our issue tracker for details:
https://github.com/golang/go/issues?q=milestone%3AGo1.19.6+label%3ACherryPickApproved
From the announcement on the security mailing:
We have just released Go versions 1.20.1 and 1.19.6, minor point releases.
These minor releases include 4 security fixes following the security policy:
- path/filepath: path traversal in filepath.Clean on Windows
On Windows, the filepath.Clean function could transform an invalid path such
as a/../c:/b into the valid path c:\b. This transformation of a relative (if
invalid) path into an absolute path could enable a directory traversal attack.
The filepath.Clean function will now transform this path into the relative
(but still invalid) path .\c:\b.
This is CVE-2022-41722 and Go issue https://go.dev/issue/57274.
- net/http, mime/multipart: denial of service from excessive resource
consumption
Multipart form parsing with mime/multipart.Reader.ReadForm can consume largely
unlimited amounts of memory and disk files. This also affects form parsing in
the net/http package with the Request methods FormFile, FormValue,
ParseMultipartForm, and PostFormValue.
ReadForm takes a maxMemory parameter, and is documented as storing "up to
maxMemory bytes +10MB (reserved for non-file parts) in memory". File parts
which cannot be stored in memory are stored on disk in temporary files. The
unconfigurable 10MB reserved for non-file parts is excessively large and can
potentially open a denial of service vector on its own. However, ReadForm did
not properly account for all memory consumed by a parsed form, such as map
ntry overhead, part names, and MIME headers, permitting a maliciously crafted
form to consume well over 10MB. In addition, ReadForm contained no limit on
the number of disk files created, permitting a relatively small request body
to create a large number of disk temporary files.
ReadForm now properly accounts for various forms of memory overhead, and
should now stay within its documented limit of 10MB + maxMemory bytes of
memory consumption. Users should still be aware that this limit is high and
may still be hazardous.
ReadForm now creates at most one on-disk temporary file, combining multiple
form parts into a single temporary file. The mime/multipart.File interface
type's documentation states, "If stored on disk, the File's underlying
concrete type will be an *os.File.". This is no longer the case when a form
contains more than one file part, due to this coalescing of parts into a
single file. The previous behavior of using distinct files for each form part
may be reenabled with the environment variable
GODEBUG=multipartfiles=distinct.
Users should be aware that multipart.ReadForm and the http.Request methods
that call it do not limit the amount of disk consumed by temporary files.
Callers can limit the size of form data with http.MaxBytesReader.
This is CVE-2022-41725 and Go issue https://go.dev/issue/58006.
- crypto/tls: large handshake records may cause panics
Both clients and servers may send large TLS handshake records which cause
servers and clients, respectively, to panic when attempting to construct
responses.
This affects all TLS 1.3 clients, TLS 1.2 clients which explicitly enable
session resumption (by setting Config.ClientSessionCache to a non-nil value),
and TLS 1.3 servers which request client certificates (by setting
Config.ClientAuth
> = RequestClientCert).
This is CVE-2022-41724 and Go issue https://go.dev/issue/58001.
- net/http: avoid quadratic complexity in HPACK decoding
A maliciously crafted HTTP/2 stream could cause excessive CPU consumption
in the HPACK decoder, sufficient to cause a denial of service from a small
number of small requests.
This issue is also fixed in golang.org/x/net/http2 v0.7.0, for users manually
configuring HTTP/2.
This is CVE-2022-41723 and Go issue https://go.dev/issue/57855.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 94feb31516cd99749fa797e16e2bc11840d86613)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-02-14 19:41:04 +00:00
|
|
|
ARG GO_VERSION=1.19.6
|
2019-07-17 11:59:16 +00:00
|
|
|
|
|
|
|
FROM golang:${GO_VERSION}-alpine AS base
|
2019-09-11 07:36:53 +00:00
|
|
|
ENV GO111MODULE=off
|
2018-10-03 00:57:42 +00:00
|
|
|
RUN apk --no-cache add \
|
2017-09-08 14:43:04 +00:00
|
|
|
bash \
|
|
|
|
build-base \
|
|
|
|
curl \
|
|
|
|
lvm2-dev \
|
2018-10-03 00:57:42 +00:00
|
|
|
jq
|
2017-09-08 14:43:04 +00:00
|
|
|
|
2019-04-19 14:15:03 +00:00
|
|
|
RUN mkdir -p /build/
|
2017-09-08 14:43:04 +00:00
|
|
|
RUN mkdir -p /go/src/github.com/docker/docker/
|
|
|
|
WORKDIR /go/src/github.com/docker/docker/
|
|
|
|
|
2019-04-19 14:15:03 +00:00
|
|
|
FROM base AS frozen-images
|
|
|
|
# Get useful and necessary Hub images so we can "docker load" locally instead of pulling
|
|
|
|
COPY contrib/download-frozen-image-v2.sh /
|
|
|
|
RUN /download-frozen-image-v2.sh /build \
|
2021-08-19 21:40:38 +00:00
|
|
|
busybox:latest@sha256:95cf004f559831017cdf4628aaf1bb30133677be8702a8c5f2994629f637a209 \
|
|
|
|
busybox:latest@sha256:95cf004f559831017cdf4628aaf1bb30133677be8702a8c5f2994629f637a209 \
|
|
|
|
debian:bullseye-slim@sha256:dacf278785a4daa9de07596ec739dbc07131e189942772210709c5c0777e8437 \
|
|
|
|
hello-world:latest@sha256:d58e752213a51785838f9eed2b7a498ffa1cb3aa7f946dda11af39286c3db9a9 \
|
|
|
|
arm32v7/hello-world:latest@sha256:50b8560ad574c779908da71f7ce370c0a2471c098d44d1c8f6b513c5a55eeeb1
|
2020-12-16 13:53:49 +00:00
|
|
|
# See also frozenImages in "testutil/environment/protect.go" (which needs to be updated when adding images to this list)
|
2019-04-19 14:15:03 +00:00
|
|
|
|
2019-04-19 14:24:33 +00:00
|
|
|
FROM base AS dockercli
|
|
|
|
COPY hack/dockerfile/install/install.sh ./install.sh
|
2022-07-02 15:00:34 +00:00
|
|
|
COPY hack/dockerfile/install/dockercli.installer ./
|
|
|
|
RUN PREFIX=/build ./install.sh dockercli
|
2017-09-08 14:43:04 +00:00
|
|
|
|
2022-06-16 20:47:36 +00:00
|
|
|
# TestDockerCLIBuildSuite dependency
|
2019-04-19 14:26:10 +00:00
|
|
|
FROM base AS contrib
|
|
|
|
COPY contrib/syscall-test /build/syscall-test
|
|
|
|
COPY contrib/httpserver/Dockerfile /build/httpserver/Dockerfile
|
|
|
|
COPY contrib/httpserver contrib/httpserver
|
|
|
|
RUN CGO_ENABLED=0 go build -buildmode=pie -o /build/httpserver/httpserver github.com/docker/docker/contrib/httpserver
|
|
|
|
|
|
|
|
# Build the integration tests and copy the resulting binaries to /build/tests
|
2019-04-19 14:24:33 +00:00
|
|
|
FROM base AS builder
|
2017-09-08 14:43:04 +00:00
|
|
|
|
2017-09-12 12:53:20 +00:00
|
|
|
# Set tag and add sources
|
2019-04-19 14:20:24 +00:00
|
|
|
COPY . .
|
2019-04-27 04:38:55 +00:00
|
|
|
# Copy test sources tests that use assert can print errors
|
|
|
|
RUN mkdir -p /build${PWD} && find integration integration-cli -name \*_test.go -exec cp --parents '{}' /build${PWD} \;
|
|
|
|
# Build and install test binaries
|
2019-04-30 07:22:22 +00:00
|
|
|
ARG DOCKER_GITCOMMIT=undefined
|
2017-09-08 14:43:04 +00:00
|
|
|
RUN hack/make.sh build-integration-test-binary
|
2019-04-27 04:38:55 +00:00
|
|
|
RUN mkdir -p /build/tests && find . -name test.main -exec cp --parents '{}' /build/tests \;
|
2017-09-08 14:43:04 +00:00
|
|
|
|
2019-04-19 14:15:03 +00:00
|
|
|
## Generate testing image
|
2019-06-23 17:39:20 +00:00
|
|
|
FROM alpine:3.10 as runner
|
2017-09-08 14:43:04 +00:00
|
|
|
|
2019-04-19 14:20:24 +00:00
|
|
|
ENV DOCKER_REMOTE_DAEMON=1
|
|
|
|
ENV DOCKER_INTEGRATION_DAEMON_DEST=/
|
|
|
|
ENTRYPOINT ["/scripts/run.sh"]
|
|
|
|
|
|
|
|
# Add an unprivileged user to be used for tests which need it
|
|
|
|
RUN addgroup docker && adduser -D -G docker unprivilegeduser -s /bin/ash
|
|
|
|
|
2017-09-08 14:43:04 +00:00
|
|
|
# GNU tar is used for generating the emptyfs image
|
2018-10-03 00:57:42 +00:00
|
|
|
RUN apk --no-cache add \
|
2017-09-08 14:43:04 +00:00
|
|
|
bash \
|
|
|
|
ca-certificates \
|
|
|
|
g++ \
|
|
|
|
git \
|
2021-08-19 19:16:01 +00:00
|
|
|
inetutils-ping \
|
2017-09-08 14:43:04 +00:00
|
|
|
iptables \
|
2021-08-19 19:16:01 +00:00
|
|
|
libcap2-bin \
|
2018-01-16 18:49:18 +00:00
|
|
|
pigz \
|
2017-09-08 14:43:04 +00:00
|
|
|
tar \
|
2018-10-03 00:57:42 +00:00
|
|
|
xz
|
2017-09-08 14:43:04 +00:00
|
|
|
|
2019-04-19 14:20:24 +00:00
|
|
|
COPY hack/test/e2e-run.sh /scripts/run.sh
|
|
|
|
COPY hack/make/.ensure-emptyfs /scripts/ensure-emptyfs.sh
|
2017-09-08 14:43:04 +00:00
|
|
|
|
2019-04-19 14:02:22 +00:00
|
|
|
COPY integration/testdata /tests/integration/testdata
|
|
|
|
COPY integration/build/testdata /tests/integration/build/testdata
|
|
|
|
COPY integration-cli/fixtures /tests/integration-cli/fixtures
|
2017-09-08 14:43:04 +00:00
|
|
|
|
2019-04-19 14:15:03 +00:00
|
|
|
COPY --from=frozen-images /build/ /docker-frozen-images
|
2019-04-19 14:24:33 +00:00
|
|
|
COPY --from=dockercli /build/ /usr/bin/
|
2019-04-19 14:26:10 +00:00
|
|
|
COPY --from=contrib /build/ /tests/contrib/
|
2019-04-27 04:38:55 +00:00
|
|
|
COPY --from=builder /build/ /
|