From 88bb253554a8d805b9d333be8e4f1b3557d0ba60 Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Fri, 6 Oct 2023 11:45:29 -0400 Subject: [PATCH] fix(cli): Remove websocket message size limit (#3808) When the boundary client establishes a connection to the websocket used to communicate with a worker, it was configured with a max websocket message size of 32KiB. This was the default behavior for v1.8.7 of nhooyr/websocket. However, there are cases where the worker can send messages to the client that are larger than 32KiB. When this happens the client returns an error and terminates the connection. Notably this seems to only currently impact sessions made to SSH Targets, although it could theoretically impact any target type depending on the details of how the worker performs the writing of the messages. The issue can be reproduced by attempting to scp a large enough file from an SSH Target to the client. In this case the connection gets terminated and results in a partial transfer of the file. This message size limit appears to be unnecessary, and the default behavior is changing in v1.8.8 of nhooyr/websocket to make the message size unlimited. Since this version is not yet released, this commit switches the dependency to a fork with a version that is v1.8.7 plus the patch to disable the limit. Once v1.8.8 is release this dependency can be set back. See: https://github.com/nhooyr/websocket/pull/254 https://github.com/nhooyr/websocket/pull/256 --- CHANGELOG.md | 4 ++++ go.mod | 2 ++ go.sum | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 045a86ee67..50df211b16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,10 @@ Canonical reference for changes, improvements, and bugfixes for Boundary. submitted ([PR](https://github.com/hashicorp/boundary/pull/3800)) * worker: Fix an issue that could cause intermittent startup issues on slow systems ([PR](https://github.com/hashicorp/boundary/pull/3803)) +* cli: Remove websocket max message size. This fixes issues where large message + sizes are sent to the client from a worker which resulted in the connection + being terminated, as is the case with an scp download when using an SSH + Target. ([PR](https://github.com/hashicorp/boundary/pull/3808)) ## 0.13.1 (2023/07/10) diff --git a/go.mod b/go.mod index 6c28fa1501..625aba50ca 100644 --- a/go.mod +++ b/go.mod @@ -204,3 +204,5 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect gorm.io/driver/sqlite v1.5.3 // indirect ) + +replace nhooyr.io/websocket => github.com/tmessi/websocket v0.0.0-20231006132118-662e2f7878ac diff --git a/go.sum b/go.sum index d21a6a87d8..dd2923a6b2 100644 --- a/go.sum +++ b/go.sum @@ -727,6 +727,8 @@ github.com/tj/go-buffer v1.1.0/go.mod h1:iyiJpfFcR2B9sXu7KvjbT9fpM4mOelRSDTbntVj github.com/tj/go-elastic v0.0.0-20171221160941-36157cbbebc2/go.mod h1:WjeM0Oo1eNAjXGDx2yma7uG2XoyRZTq1uv3M/o7imD0= github.com/tj/go-kinesis v0.0.0-20171128231115-08b17f58cb1b/go.mod h1:/yhzCV0xPfx6jb1bBgRFjl5lytqVqZXEaeqWP8lTEao= github.com/tj/go-spin v1.1.0/go.mod h1:Mg1mzmePZm4dva8Qz60H2lHwmJ2loum4VIrLgVnKwh4= +github.com/tmessi/websocket v0.0.0-20231006132118-662e2f7878ac h1:ws8O6PTC7/A7JK8QQUqXEE+ZGEpk0QRXTCqncXIrKfQ= +github.com/tmessi/websocket v0.0.0-20231006132118-662e2f7878ac/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= @@ -1209,8 +1211,6 @@ honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 mvdan.cc/gofumpt v0.1.1/go.mod h1:yXG1r1WqZVKWbVRtBWKWX9+CxGYfA51nSomhM0woR48= mvdan.cc/gofumpt v0.4.0 h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM= mvdan.cc/gofumpt v0.4.0/go.mod h1:PljLOHDeZqgS8opHRKLzp2It2VBuSdteAgqUfzMTxlQ= -nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g= -nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=