fix(sandbox): avoid sandboxing main DM sessions

This commit is contained in:
Peter Steinberger
2026-01-12 01:23:37 +00:00
parent b9ff4ca1fe
commit 58a12a757e
9 changed files with 207 additions and 109 deletions

View File

@@ -1480,6 +1480,13 @@ export async function startGatewayServer(
? `invalid connect params: ${formatValidationErrors(validateConnectParams.errors)}`
: "invalid handshake: first request must be connect"
: "invalid request frame";
handshakeState = "failed";
setCloseCause("invalid-handshake", {
frameType,
frameMethod,
frameId,
handshakeError,
});
if (isRequestFrame) {
const req = parsed as RequestFrame;
send({
@@ -1493,13 +1500,6 @@ export async function startGatewayServer(
`invalid handshake conn=${connId} remote=${remoteAddr ?? "?"}`,
);
}
handshakeState = "failed";
setCloseCause("invalid-handshake", {
frameType,
frameMethod,
frameId,
handshakeError,
});
const closeReason = truncateCloseReason(
handshakeError || "invalid handshake",
);