Sebastiaan van Stijn
74b4974cb7
client: define a "dummy" hostname to use for local connections
...
For local communications (npipe://, unix://), the hostname is not used,
but we need valid and meaningful hostname.
The current code used the client's `addr` as hostname in some cases, which
could contain the path for the unix-socket (`/var/run/docker.sock`), which
gets rejected by go1.20.6 and go1.19.11 because of a security fix for
[CVE-2023-29406 ][1], which was implemented in https://go.dev/issue/60374 .
Prior versions go Go would clean the host header, and strip slashes in the
process, but go1.20.6 and go1.19.11 no longer do, and reject the host
header.
This patch introduces a `DummyHost` const, and uses this dummy host for
cases where we don't need an actual hostname.
Before this patch (using go1.20.6):
make GO_VERSION=1.20.6 TEST_FILTER=TestAttach test-integration
=== RUN TestAttachWithTTY
attach_test.go:46: assertion failed: error is not nil: http: invalid Host header
--- FAIL: TestAttachWithTTY (0.11s)
=== RUN TestAttachWithoutTTy
attach_test.go:46: assertion failed: error is not nil: http: invalid Host header
--- FAIL: TestAttachWithoutTTy (0.02s)
FAIL
With this patch applied:
make GO_VERSION=1.20.6 TEST_FILTER=TestAttach test-integration
INFO: Testing against a local daemon
=== RUN TestAttachWithTTY
--- PASS: TestAttachWithTTY (0.12s)
=== RUN TestAttachWithoutTTy
--- PASS: TestAttachWithoutTTy (0.02s)
PASS
[1]: https://github.com/advisories/GHSA-f8f7-69v5-w4vx
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
(cherry picked from commit 92975f0c11 )
Signed-off-by: Sebastiaan van Stijn <github@gone.nl >
2023-07-15 01:27:29 +02:00
..
2016-09-07 11:05:58 -07:00
2019-03-18 15:26:21 +01:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2019-01-21 15:27:52 +01:00
2023-02-24 16:11:55 -05:00
2023-02-24 16:11:55 -05:00
2022-04-07 23:27:50 +02:00
2018-02-08 15:26:24 +01:00
2023-07-15 01:27:29 +02:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2023-02-24 16:11:55 -05:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2023-02-24 17:05:41 -05:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2022-03-22 16:34:19 -04:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2023-02-24 16:11:55 -05:00
2023-02-24 16:11:55 -05:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2023-02-24 16:11:55 -05:00
2019-10-18 00:45:33 +02:00
2023-02-24 16:11:55 -05:00
2023-02-24 17:05:41 -05:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2023-02-24 16:11:55 -05:00
2020-02-28 09:54:37 -08:00
2023-02-24 16:11:55 -05:00
2018-05-30 13:38:42 -04:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2020-02-11 00:06:42 +01:00
2019-03-18 15:26:21 +01:00
2020-04-29 00:28:41 +02:00
2023-02-24 16:11:55 -05:00
2019-10-18 00:45:33 +02:00
2023-02-24 16:11:55 -05:00
2023-07-15 01:27:29 +02:00
2023-02-24 16:11:55 -05:00
2019-03-19 10:28:30 -07:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2019-11-27 15:44:49 +01:00
2023-02-24 16:11:55 -05:00
2023-02-24 16:11:55 -05:00
2023-02-24 16:11:55 -05:00
2019-10-18 00:45:33 +02:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2019-03-16 00:42:42 +01:00
2023-02-24 16:11:55 -05:00
2019-12-10 12:24:14 +01:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2018-04-23 13:52:44 -07:00
2018-02-05 16:51:57 -05:00
2020-05-21 11:33:27 -07:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2023-02-24 16:11:55 -05:00
2023-02-24 16:11:55 -05:00
2023-02-24 16:11:55 -05:00
2019-10-18 00:45:33 +02:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2023-02-24 16:11:55 -05:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2020-02-11 00:06:42 +01:00
2019-04-20 13:34:22 +02:00
2023-02-24 16:11:55 -05:00
2020-01-20 00:04:53 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2023-02-24 16:11:55 -05:00
2023-02-24 16:11:55 -05:00
2019-03-16 00:42:42 +01:00
2023-02-24 16:11:55 -05:00
2019-10-18 00:45:33 +02:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2018-04-23 13:52:44 -07:00
2019-01-03 22:49:00 +01:00
2023-07-15 01:27:29 +02:00
2023-07-15 01:27:29 +02:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2023-02-24 16:11:55 -05:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2023-02-24 16:11:55 -05:00
2020-04-16 21:30:57 +02:00
2023-02-24 16:11:55 -05:00
2023-02-24 16:11:55 -05:00
2023-02-24 16:11:55 -05:00
2019-10-14 10:43:00 -05:00
2023-02-24 16:11:55 -05:00
2018-05-20 13:07:17 +02:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2020-04-16 21:30:57 +02:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2023-02-24 16:11:55 -05:00
2018-04-23 13:52:44 -07:00
2023-02-24 16:11:55 -05:00
2023-02-24 16:11:55 -05:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2018-04-23 13:52:44 -07:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2023-02-24 16:11:55 -05:00
2023-02-24 16:11:55 -05:00
2019-10-18 00:45:33 +02:00
2019-03-18 15:26:21 +01:00
2023-02-24 16:11:55 -05:00
2019-03-18 15:26:21 +01:00