fix: stop main-session UI replies inheriting channel routes#43918
fix: stop main-session UI replies inheriting channel routes#43918
Conversation
🔒 Aisle Security AnalysisWe found 1 potential security issue(s) in this PR:
1. 🟠 Client mode spoofing allows unauthorized inheritance of external delivery routes (Telegram/WhatsApp)
DescriptionThe gateway uses In
As a result, any client that can connect and call Vulnerable decision point: const isFromGatewayCliClient = isGatewayCliClient(params.client);
...
const canInheritConfiguredMainRoute =
isConfiguredMainSessionScope &&
params.hasConnectedClient &&
(isFromGatewayCliClient || !hasClientMetadata);
export function isGatewayCliClient(client?: GatewayClientInfoLike | null): boolean {
return normalizeGatewayClientMode(client?.mode) === GATEWAY_CLIENT_MODES.CLI;
}Other call sites of RecommendationDo not make authorization/routing decisions based on client-declared metadata fields ( Recommended options (in increasing robustness):
Concrete example approach (server-attested flag): // During WS handshake (server-side):
const isBrowser = Boolean(requestOrigin); // or hasBrowserOriginHeader
clientContext.isGatewayCli = !isBrowser && connectParams.client.mode === GATEWAY_CLIENT_MODES.CLI;
// In chat.ts:
const isFromGatewayCliClient = Boolean(params.clientContext?.isGatewayCli);Additionally, consider removing the Analyzed PR: #43918 at commit Last updated on: 2026-03-12T11:00:53Z |
Greptile SummaryThis PR fixes a routing bug where The fix tightens the Key changes:
Minor observation: The pre-existing test Confidence Score: 4/5
|
5713f7b to
8d87283
Compare
Summary
chat.sendon configured main sessions letmode:UIcallers inherit the session's persisted external delivery route.gateway-clientreplies could be delivered to Telegram or another channel instead of staying on the originating UI surface.deliver:trueonagent:main:main.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
deliveris enabled.Security Impact (required)
Yes/No) NoYes/No) NoYes/No) NoYes/No) NoYes/No) NoYes, explain risk + mitigation:Repro + Verification
Environment
openai-codex/gpt-5.2agent:main:main, Telegram delivery context already pinned on the main sessionSteps
agent:main:mainwith persisted Telegram delivery context.gateway-client,mode:UI).chat.sendwithdeliver:trueon the main session.Expected
Actual
resolveChatSendOriginatingRoute().Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
dist; restartedai.openclaw.gateway; connected a real TUI-style WS client; ranchat.send+agent.wait; confirmed the assistant reply landed in the main-session transcript and did not emit a newtelegram sendMessage ok chat=200482621log line.Review Conversations
Compatibility / Migration
Yes/No) YesYes/No) NoYes/No) NoFailure Recovery (if this breaks)
src/gateway/server-methods/chat.tsRisks and Mitigations