惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
人人都是产品经理
人人都是产品经理
博客园 - 聂微东
WordPress大学
WordPress大学
S
SegmentFault 最新的问题
博客园 - Franky
V
V2EX
Y
Y Combinator Blog
Google DeepMind News
Google DeepMind News
J
Java Code Geeks
T
The Blog of Author Tim Ferriss
罗磊的独立博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Jina AI
Jina AI
博客园 - 叶小钗
F
Fortinet All Blogs
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
A
About on SuperTechFans
M
MIT News - Artificial intelligence
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
D
Docker
博客园 - 【当耐特】
阮一峰的网络日志
阮一峰的网络日志

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(qa-channel): reject malformed inline attachment data ...
vincentkoc · 2026-05-14 · via Recent Commits to openclaw:main

File tree

  • extensions/qa-channel/src

Original file line numberDiff line numberDiff line change

@@ -38,6 +38,7 @@ Docs: https://docs.openclaw.ai

3838

- Google Meet/Codex: report malformed node proxy `payloadJSON` responses with plugin-owned errors instead of leaking raw JSON parser failures.

3939

- Debug proxy: reject malformed relative-form proxy targets with a controlled 400 response instead of letting URL parsing escape the request handler.

4040

- File transfer: reject malformed inline `file_write` base64 before computing hashes or invoking paired nodes, avoiding Node's lenient base64 decoder.

41+

- QA channel: skip malformed inline inbound attachment base64 instead of staging silently corrupted media for agent turns.

4142

- Models config/auth: stop inferring provider env-var markers from broad `^[A-Z_][A-Z0-9_]*$` strings, and resolve config-backed provider `apiKey` values only through structured env SecretRefs (`secrets.providers[id]` / `secrets.defaults`), so unrelated env vars cannot accidentally become provider credentials. Thanks @sallyom.

4243

- Media fetch: skip allocating and buffering the response body for bodyless media responses (HEAD probes and 204-style empty bodies), avoiding wasted heap on streams that carry no payload. Thanks @shakkernerd.

4344

- CLI/onboarding: forward provider-specific auth flags (e.g. `--openai-api-key`) through the onboarding wizard so they reach provider auth methods via `ctx.opts`, letting `--openai-api-key "$OPENAI_API_KEY"` skip the redundant "use existing env var?" prompt in non-interactive harnesses. (#81669) Thanks @sjf.

Original file line numberDiff line numberDiff line change

@@ -124,6 +124,31 @@ describe("handleQaInbound", () => {

124124

expect(ctxPayload?.SenderId).toBe("alice");

125125

});

126126
127+

it("skips malformed inline attachment base64 without dropping the message", async () => {

128+

const runtime = createPluginRuntimeMock();

129+

setQaChannelRuntime(runtime);

130+
131+

await handleQaInbound(

132+

createQaInboundParams({

133+

message: {

134+

attachments: [

135+

{

136+

id: "attachment-1",

137+

kind: "image",

138+

mimeType: "image/png",

139+

contentBase64: "AAA@@@",

140+

},

141+

],

142+

},

143+

}),

144+

);

145+
146+

expect(runtime.channel.turn.runAssembled).toHaveBeenCalledTimes(1);

147+

const ctxPayload = firstRunAssembledParams(runtime).ctxPayload;

148+

expect(ctxPayload.MediaPath).toBeUndefined();

149+

expect(ctxPayload.MediaPaths).toBeUndefined();

150+

});

151+
127152

it("uses allowFrom as the group sender fallback for allowlist policy", async () => {

128153

const runtime = createPluginRuntimeMock();

129154

setQaChannelRuntime(runtime);

Original file line numberDiff line numberDiff line change

@@ -19,6 +19,18 @@ export function isHttpMediaUrl(value: string): boolean {

1919

}

2020

}

2121
22+

function normalizeBase64ForCompare(value: string): string {

23+

return value.replace(/=+$/u, "").replace(/-/gu, "+").replace(/_/gu, "/");

24+

}

25+
26+

function decodeAttachmentBase64(value: string): Buffer | null {

27+

const buffer = Buffer.from(value, "base64");

28+

if (normalizeBase64ForCompare(buffer.toString("base64")) !== normalizeBase64ForCompare(value)) {

29+

return null;

30+

}

31+

return buffer;

32+

}

33+
2234

async function resolveQaInboundMediaPayload(attachments: QaBusMessage["attachments"]) {

2335

if (!Array.isArray(attachments) || attachments.length === 0) {

2436

return {};

@@ -29,8 +41,13 @@ async function resolveQaInboundMediaPayload(attachments: QaBusMessage["attachmen

2941

continue;

3042

}

3143

if (typeof attachment.contentBase64 === "string" && attachment.contentBase64.trim()) {

44+

const buffer = decodeAttachmentBase64(attachment.contentBase64);

45+

if (!buffer) {

46+

console.warn("[qa-channel] inbound attachment contentBase64 rejected (invalid base64)");

47+

continue;

48+

}

3249

const saved = await saveMediaBuffer(

33-

Buffer.from(attachment.contentBase64, "base64"),

50+

buffer,

3451

attachment.mimeType,

3552

"inbound",

3653

undefined,