From e0276ed4b460f52ffe7f48b8a061154eef810b2d Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 17 Dec 2025 22:04:22 +0100 Subject: [PATCH] fix(gateway): harden request handling --- src/gateway/protocol/schema.ts | 2 -- src/gateway/server.ts | 11 ++++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/gateway/protocol/schema.ts b/src/gateway/protocol/schema.ts index 0fa9b69a1..ce9bea42c 100644 --- a/src/gateway/protocol/schema.ts +++ b/src/gateway/protocol/schema.ts @@ -69,8 +69,6 @@ export const ConnectParamsSchema = Type.Object( modelIdentifier: Type.Optional(NonEmptyString), mode: NonEmptyString, instanceId: Type.Optional(NonEmptyString), - deviceFamily: Type.Optional(NonEmptyString), - modelIdentifier: Type.Optional(NonEmptyString), }, { additionalProperties: false }, ), diff --git a/src/gateway/server.ts b/src/gateway/server.ts index 78e6bab60..e0b044a19 100644 --- a/src/gateway/server.ts +++ b/src/gateway/server.ts @@ -2024,7 +2024,8 @@ export async function startGatewayServer( }); }; - switch (req.method) { + void (async () => { + switch (req.method) { case "connect": { respond( false, @@ -3372,6 +3373,14 @@ export async function startGatewayServer( break; } } + })().catch((err) => { + logError(`gateway: request handler failed: ${formatForLog(err)}`); + respond( + false, + undefined, + errorShape(ErrorCodes.UNAVAILABLE, formatForLog(err)), + ); + }); } catch (err) { logError(`gateway: parse/handle error: ${String(err)}`); logWs("out", "parse-error", { connId, error: formatForLog(err) });