fix(gateway): preserve raw media invoke for HTTP tool clients#34365
fix(gateway): preserve raw media invoke for HTTP tool clients#34365
Conversation
Greptile SummaryThis PR adds an Key changes:
Confidence Score: 4/5
Last reviewed commit: fffaa70 |
fffaa70 to
4784160
Compare
🔒 Aisle Security AnalysisWe found 3 potential security issue(s) in this PR:
1. 🟠 Media/base64 payload exposure & DoS via nodes action="invoke" when allowMediaInvokeCommands enabled
DescriptionThe generic nodes tool path Dedicated media actions (e.g.,
With
Vulnerable code (generic invoke path now permits media commands when the flag is set): const dedicatedAction = MEDIA_INVOKE_ACTIONS[invokeCommandNormalized as keyof typeof MEDIA_INVOKE_ACTIONS];
if (dedicatedAction && !options?.allowMediaInvokeCommands) {
throw new Error(...);
}
...
const raw = await callGatewayTool("node.invoke", gatewayOpts, { nodeId, command: invokeCommand, params: invokeParams, ... });
return jsonResult(raw ?? {});RecommendationDo not allow raw media-returning node commands through the generic Recommended fixes (choose one):
if (dedicatedAction) {
// internally dispatch to the same implementation as action="photos_latest"/"camera_snap"/...
return await handleDedicatedMediaAction(dedicatedAction, params);
}
Also ensure 2. 🟠 POST /tools/invoke enables raw camera/screen media exfiltration via allowMediaInvokeCommands=true
Description
This disables the safety check in the Impact:
Vulnerable flow (new behavior):
Relevant code: // src/gateway/tools-invoke-http.ts
const allTools = createOpenClawTools({
...
// HTTP callers consume tool output directly; preserve raw media invoke payloads.
allowMediaInvokeCommands: true,
...
});// src/agents/tools/nodes-tool.ts
const dedicatedAction = MEDIA_INVOKE_ACTIONS[invokeCommandNormalized as ...];
if (dedicatedAction && !options?.allowMediaInvokeCommands) {
throw new Error("... blocked ...");
}
...
return jsonResult(raw ?? {}); // includes payload base64RecommendationDo not enable raw media-returning Suggested mitigation options:
// src/gateway/tools-invoke-http.ts
const allowMediaInvokeCommands = cfg.gateway?.tools?.allowMediaInvokeCommands === true;
const allTools = createOpenClawTools({
...,
allowMediaInvokeCommands,
});
3. 🟡 Unbounded media/base64 payloads enabled for HTTP /tools/invoke via allowMediaInvokeCommands
Description
Impact:
Vulnerable change (enables the bypass for all HTTP tool invocations): const allTools = createOpenClawTools({
// ...
allowMediaInvokeCommands: true,
// ...
});This is particularly risky because RecommendationDo not enable raw media invoke payloads by default on the generic HTTP tool surface, or enforce strict size/parameter limits when it is enabled. Option A (safer default): remove the unconditional enablement so media-returning commands remain blocked via const allTools = createOpenClawTools({
// ...
// allowMediaInvokeCommands: true, // remove
config: cfg,
});Option B (if raw payloads are required): gate it behind an explicit, privileged request option (and/or stronger auth scope), and add a hard cap on response sizes for
This preserves functionality while preventing oversized responses from exhausting memory/bandwidth. Analyzed PR: #34365 at commit Last updated on: 2026-03-04T12:18:05Z |
* main: (92 commits) fix: preserve raw media invoke for HTTP tool clients (openclaw#34365) fix: prevent nodes media base64 context bloat (openclaw#34332) docs(changelog): credit @Brotherinlaw-13 for openclaw#34318 fix(telegram): materialize dm draft final to avoid duplicates fix: relay ACP sessions_spawn parent streaming (openclaw#34310) (thanks @vincentkoc) (openclaw#34310) fix: kill stuck ACP child processes on startup and harden sessions in discord threads (openclaw#33699) feat(ios): add Live Activity connection status + stale cleanup (openclaw#33591) chore(docs): add plugins refactor changelog entry Chore: remove accidental .DS_Store artifact Plugins/zalouser: migrate to scoped plugin-sdk imports Plugins/zalo: migrate to scoped plugin-sdk imports Plugins/whatsapp: migrate to scoped plugin-sdk imports Plugins/voice-call: migrate to scoped plugin-sdk imports Plugins/twitch: migrate to scoped plugin-sdk imports Plugins/tlon: migrate to scoped plugin-sdk imports Plugins/thread-ownership: migrate to scoped plugin-sdk imports Plugins/test-utils: migrate to scoped plugin-sdk imports Plugins/talk-voice: migrate to scoped plugin-sdk imports Plugins/synology-chat: migrate to scoped plugin-sdk imports Plugins/qwen-portal-auth: migrate to scoped plugin-sdk imports ...
Summary
nodesinvoke blocked by default for agent-context safety/tools/invokeclients onlyTest