Sebastiaan van Stijn
5532d516be
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-14 22:49:58 +02:00
..
2021-02-16 10:07:44 -05:00
2019-03-18 15:26:21 +01:00
2021-08-27 14:56:57 +08:00
2018-04-23 13:52:44 -07:00
2021-08-27 14:56:57 +08:00
2018-04-23 13:52:44 -07:00
2021-08-27 14:56:57 +08:00
2022-03-20 19:04:52 +01:00
2023-04-21 12:05:15 +02:00
2021-08-27 14:56:57 +08:00
2022-05-28 12:12:39 +02:00
2022-03-07 12:35:55 +01:00
2022-03-07 12:35:55 +01:00
2023-07-14 22:49:58 +02:00
2021-08-27 14:56:57 +08:00
2021-02-16 10:07:44 -05:00
2021-08-27 14:56:57 +08:00
2022-03-20 19:04:52 +01:00
2021-08-27 14:56:57 +08:00
2019-03-18 15:26:21 +01:00
2021-08-27 14:56:57 +08:00
2022-03-20 19:04:52 +01:00
2021-08-27 14:56:57 +08:00
2022-05-13 02:40:14 +02:00
2022-07-13 22:42:29 +02:00
2021-08-27 14:56:57 +08:00
2021-02-16 10:07:44 -05:00
2022-04-19 08:28:20 +02:00
2022-04-19 08:28:20 +02:00
2022-04-28 22:39:20 +02:00
2022-09-21 16:27:20 +02:00
2021-08-27 14:56:57 +08:00
2019-03-18 15:26:21 +01:00
2021-08-27 14:56:57 +08:00
2022-06-24 11:54:25 +02:00
2021-08-27 14:56:57 +08:00
2018-04-23 13:52:44 -07:00
2021-08-27 14:56:57 +08:00
2022-03-20 19:04:52 +01:00
2021-08-27 14:56:57 +08:00
2022-04-19 17:40:33 +02:00
2022-03-31 19:59:17 +02:00
2022-03-31 19:59:17 +02:00
2021-08-27 14:56:57 +08:00
2022-07-13 22:42:29 +02:00
2021-08-27 14:56:57 +08:00
2018-04-23 13:52:44 -07:00
2021-08-27 14:56:57 +08:00
2019-03-18 15:26:21 +01:00
2022-03-20 19:04:52 +01:00
2022-03-20 19:04:52 +01:00
2021-08-27 14:56:57 +08:00
2018-04-23 13:52:44 -07:00
2021-08-27 14:56:57 +08:00
2018-04-23 13:52:44 -07:00
2022-04-20 21:29:34 +02:00
2022-04-20 21:29:34 +02:00
2021-08-27 14:56:57 +08:00
2018-04-23 13:52:44 -07:00
2021-08-27 14:56:57 +08:00
2020-02-28 09:54:37 -08:00
2022-04-20 21:29:34 +02:00
2022-04-20 21:29:34 +02:00
2021-08-27 14:56:57 +08:00
2019-03-18 15:26:21 +01:00
2021-08-27 14:56:57 +08:00
2018-04-23 13:52:44 -07:00
2021-08-27 14:56:57 +08:00
2021-02-16 10:07:44 -05:00
2023-01-30 15:03:01 +01:00
2023-01-30 15:03:01 +01:00
2021-08-27 14:56:57 +08:00
2021-07-27 12:17:45 +02:00
2020-02-11 00:06:42 +01:00
2021-02-16 10:07:44 -05:00
2022-03-07 12:35:55 +01:00
2022-07-13 22:44:43 +02:00
2022-10-01 00:01:13 +02:00
2022-10-01 00:01:13 +02:00
2021-08-27 14:56:57 +08:00
2023-07-14 22:49:58 +02:00
2021-08-27 14:56:57 +08:00
2021-02-16 10:07:44 -05:00
2021-08-27 14:56:57 +08:00
2021-02-16 10:07:44 -05:00
2021-08-27 14:56:57 +08:00
2019-03-18 15:26:21 +01:00
2021-08-27 14:56:57 +08:00
2021-02-16 10:07:44 -05:00
2021-08-27 14:56:57 +08:00
2022-03-20 19:04:52 +01:00
2022-11-30 17:14:21 +01:00
2022-11-30 17:14:21 +01:00
2021-08-27 14:56:57 +08:00
2018-04-23 13:52:44 -07:00
2021-08-27 14:56:57 +08:00
2019-03-18 15:26:21 +01:00
2021-08-27 14:56:57 +08:00
2019-03-16 00:42:42 +01:00
2021-08-27 14:56:57 +08:00
2019-12-10 12:24:14 +01:00
2022-03-20 19:04:52 +01:00
2022-03-20 19:04:52 +01:00
2021-08-27 14:56:57 +08:00
2018-04-23 13:52:44 -07:00
2021-08-27 14:56:57 +08:00
2022-03-15 14:53:46 +01:00
2021-08-27 14:56:57 +08:00
2018-04-23 13:52:44 -07:00
2021-08-27 14:56:57 +08: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
2022-05-13 00:55:44 +02:00
2019-03-18 15:26:21 +01:00
2021-08-27 14:56:57 +08:00
2018-04-23 13:52:44 -07:00
2021-08-27 14:56:57 +08:00
2019-03-18 15:26:21 +01:00
2021-08-27 14:56:57 +08:00
2018-04-23 13:52:44 -07:00
2022-03-20 19:04:52 +01:00
2022-03-20 19:04:52 +01:00
2021-08-27 14:56:57 +08:00
2019-10-18 00:45:33 +02:00
2021-08-27 14:56:57 +08:00
2019-03-18 15:26:21 +01:00
2021-08-27 14:56:57 +08:00
2022-03-20 19:04:52 +01:00
2021-08-27 14:56:57 +08:00
2022-03-20 19:04:52 +01:00
2021-08-27 14:56:57 +08:00
2019-03-18 15:26:21 +01:00
2021-08-27 14:56:57 +08:00
2022-03-20 19:04:52 +01:00
2021-08-27 14:56:57 +08:00
2022-05-13 02:40:14 +02:00
2022-05-28 12:12:39 +02:00
2022-08-24 01:36:57 +02:00
2022-03-25 23:57:58 +01:00
2022-03-25 23:57:58 +01:00
2019-03-18 15:26:21 +01:00
2021-08-27 14:56:57 +08:00
2018-04-23 13:52:44 -07:00
2021-08-27 14:56:57 +08:00
2018-04-23 13:52:44 -07:00
2021-08-27 14:56:57 +08:00
2022-03-20 19:04:52 +01:00
2019-03-16 00:42:42 +01:00
2021-08-27 14:56:57 +08:00
2022-03-20 19:04:52 +01:00
2021-08-27 14:56:57 +08:00
2018-04-23 13:52:44 -07:00
2021-08-27 14:56:57 +08:00
2022-03-20 19:04:52 +01:00
2021-08-27 14:56:57 +08: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-14 22:49:58 +02:00
2023-07-14 22:49:58 +02:00
2021-08-27 14:56:57 +08:00
2021-02-16 10:07:44 -05:00
2021-08-27 14:56:57 +08:00
2022-03-20 19:04:52 +01:00
2021-08-27 14:56:57 +08:00
2019-03-18 15:26:21 +01:00
2021-08-27 14:56:57 +08:00
2022-03-20 19:04:52 +01:00
2021-08-27 14:56:57 +08:00
2022-05-13 02:40:14 +02:00
2022-03-04 14:49:42 +01:00
2022-03-04 14:49:42 +01:00
2021-08-27 14:56:57 +08:00
2022-03-20 19:04:52 +01:00
2021-08-27 14:56:57 +08:00
2019-10-14 10:43:00 -05:00
2021-08-27 14:56:57 +08:00
2018-05-20 13:07:17 +02:00
2022-03-20 19:04:52 +01:00
2022-03-20 19:04:52 +01:00
2021-08-27 14:56:57 +08:00
2022-05-13 02:40:14 +02:00
2021-08-27 14:56:57 +08:00
2019-03-18 15:26:21 +01:00
2021-08-27 14:56:57 +08:00
2019-03-18 15:26:21 +01:00
2021-08-27 14:56:57 +08:00
2019-03-18 15:26:21 +01:00
2021-08-27 14:56:57 +08:00
2018-04-23 13:52:44 -07:00
2021-08-27 14:56:57 +08:00
2018-04-23 13:52:44 -07:00
2021-08-27 14:56:57 +08:00
2018-04-23 13:52:44 -07:00
2021-08-27 14:56:57 +08:00
2022-05-13 02:40:14 +02:00
2021-08-27 14:56:57 +08:00
2022-03-20 19:04:52 +01:00
2021-08-27 14:56:57 +08: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
2022-04-28 22:39:14 +02:00
2022-04-28 22:39:14 +02:00
2022-04-28 22:39:04 +02:00
2022-04-21 19:50:59 +02:00
2022-04-28 22:39:12 +02:00
2022-04-28 22:39:12 +02:00
2019-03-18 15:26:21 +01:00
2021-08-27 14:56:57 +08:00
2022-03-20 19:04:52 +01:00
2022-05-13 00:55:44 +02:00
2022-05-13 02:40:14 +02:00