Skip to content

Commit

Permalink
Update tungstenite crates to 0.20
Browse files Browse the repository at this point in the history
This upgrades tungstenite and tokio-tungstenite to 0.20 in order to
address CVE-2023-43669/GHSA-9mcr-873m-xcxp.
  • Loading branch information
pfmooney committed Sep 27, 2023
1 parent 5da7153 commit 9aa216f
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 26 deletions.
23 changes: 6 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ syn = "1.0"
tempfile = "3.2"
thiserror = "1.0"
tokio = "1"
tokio-tungstenite = "0.17"
tokio-tungstenite = "0.20"
tokio-util = "0.7"
toml = "0.7.6"
tracing = "0.1.35"
Expand Down
8 changes: 6 additions & 2 deletions bin/propolis-server/src/lib/mock_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,12 @@ async fn instance_serial(
query: Query<api::InstanceSerialConsoleStreamRequest>,
websock: WebsocketConnection,
) -> dropshot::WebsocketChannelResult {
let config =
WebSocketConfig { max_send_queue: Some(4096), ..Default::default() };
let config = WebSocketConfig {
// tune the buffer size limits down (compared to the defaults)
write_buffer_size: 4096,
max_write_buffer_size: 8192,
..Default::default()
};
let mut ws_stream = WebSocketStream::from_raw_socket(
websock.into_inner(),
Role::Server,
Expand Down
9 changes: 7 additions & 2 deletions bin/propolis-server/src/lib/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -831,8 +831,13 @@ async fn instance_serial(
let vm = ctx.vm().await?;
let serial = vm.com1().clone();

let config =
WebSocketConfig { max_send_queue: Some(4096), ..Default::default() };
let config = WebSocketConfig {
// tune the buffer size limits down (compared to the defaults)
// TODO: tuning for this could be explored
write_buffer_size: 4096,
max_write_buffer_size: 8192,
..Default::default()
};
let mut ws_stream = WebSocketStream::from_raw_socket(
websock.into_inner(),
Role::Server,
Expand Down
11 changes: 7 additions & 4 deletions lib/propolis-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ pub mod support {
.send()
.await
.map_err(|e| {
WSError::Http(http::Response::new(Some(e.to_string())))
WSError::Http(http::Response::new(Some(
e.to_string().into_bytes(),
)))
})?
.into_inner();

Expand Down Expand Up @@ -190,9 +192,10 @@ pub mod support {
tokio::time::sleep(delay).await;
Ok(Box::new(stream))
} else {
Err(WSError::Http(http::Response::new(Some(format!(
"no duplex connection found for address {address}"
)))))
Err(WSError::Http(http::Response::new(Some(
format!("no duplex connection found for address {address}")
.into_bytes(),
))))
}
}
}
Expand Down

0 comments on commit 9aa216f

Please sign in to comment.