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