fix(gateway): harden browser websocket auth chain

This commit is contained in:
Peter Steinberger
2026-02-26 01:22:28 +01:00
parent f41715a18f
commit c736f11a16
7 changed files with 105 additions and 7 deletions

View File

@@ -316,6 +316,11 @@ export async function startGatewayServer(
const authRateLimiter: AuthRateLimiter | undefined = rateLimitConfig
? createAuthRateLimiter(rateLimitConfig)
: undefined;
// Always keep a browser-origin fallback limiter for WS auth attempts.
const browserAuthRateLimiter: AuthRateLimiter = createAuthRateLimiter({
...rateLimitConfig,
exemptLoopback: false,
});
let controlUiRootState: ControlUiRootState | undefined;
if (controlUiRootOverride) {
@@ -574,6 +579,7 @@ export async function startGatewayServer(
canvasHostServerPort,
resolvedAuth,
rateLimiter: authRateLimiter,
browserRateLimiter: browserAuthRateLimiter,
gatewayMethods,
events: GATEWAY_EVENTS,
logGateway: log,
@@ -777,6 +783,7 @@ export async function startGatewayServer(
}
skillsChangeUnsub();
authRateLimiter?.dispose();
browserAuthRateLimiter.dispose();
channelHealthMonitor?.stop();
await close(opts);
},