reject connections with invalid framing

This commit is contained in:
Christien Rioux 2025-05-07 10:57:43 -04:00
parent 29397a35eb
commit a25dbf9336

View file

@ -151,6 +151,14 @@ impl RawTcpProtocolHandler {
return Ok(None);
}
// Ensure this has a chance of being proper framed, otherwise drop the connection
// This will keep upgraded WS->WSS TLS negotiations from getting punished if the
// WSS accept handler isn't enabled
if peekbuf[0] != b'V' || peekbuf[1] != b'L' {
// Not framed TCP, drop it
return Ok(None);
}
let peer_addr = PeerAddress::new(
SocketAddress::from_socket_addr(socket_addr),
ProtocolType::TCP,