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

推荐订阅源

Apple Machine Learning Research
Apple Machine Learning Research
J
Java Code Geeks
博客园 - 聂微东
Microsoft Azure Blog
Microsoft Azure Blog
量子位
T
Tailwind CSS Blog
Vercel News
Vercel News
I
InfoQ
Stack Overflow Blog
Stack Overflow Blog
U
Unit 42
Engineering at Meta
Engineering at Meta
L
LangChain Blog
大猫的无限游戏
大猫的无限游戏
D
Docker
博客园_首页
P
Proofpoint News Feed
月光博客
月光博客
T
The Blog of Author Tim Ferriss
MyScale Blog
MyScale Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Martin Fowler
Martin Fowler
腾讯CDC
N
Netflix TechBlog - Medium
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

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(voice-call): validate realtime media frame base64 · o...
vincentkoc · 2026-05-14 · via Recent Commits to openclaw:main

File tree

  • extensions/voice-call/src/webhook

Original file line numberDiff line numberDiff line change

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

4141

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

4242

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

4343

- Microsoft Teams: reject malformed inline HTML image base64 padding instead of decoding corrupted `data:` image attachments.

44+

- Voice-call realtime: ignore malformed provider media-frame base64 before forwarding audio into bridge and transcription paths.

4445

- 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.

4546

- 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.

4647

- 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

@@ -39,6 +39,9 @@ describe("TwilioStreamFrameAdapter", () => {

3939

expect(

4040

adapter.parseInbound(JSON.stringify({ event: "start", start: { streamSid: "MZ-only" } })),

4141

).toEqual({ kind: "ignored" });

42+

expect(

43+

adapter.parseInbound(JSON.stringify({ event: "media", media: { payload: "AAA@@@" } })),

44+

).toEqual({ kind: "ignored" });

4245

});

4346
4447

it("serializes outbound frames with the streamSid captured at start", () => {

@@ -174,6 +177,9 @@ describe("TelnyxStreamFrameAdapter", () => {

174177

const adapter = new TelnyxStreamFrameAdapter();

175178

expect(adapter.parseInbound("not json")).toEqual({ kind: "ignored" });

176179

expect(adapter.parseInbound(JSON.stringify({ event: "media" }))).toEqual({ kind: "ignored" });

180+

expect(

181+

adapter.parseInbound(JSON.stringify({ event: "media", media: { payload: "AAA@@@" } })),

182+

).toEqual({ kind: "ignored" });

177183

expect(adapter.parseInbound(JSON.stringify({ event: "something-else" }))).toEqual({

178184

kind: "ignored",

179185

});

Original file line numberDiff line numberDiff line change

@@ -42,6 +42,15 @@ function tryParseJson(rawMessage: string): Record<string, unknown> | null {

4242

return null;

4343

}

4444
45+

function normalizeBase64ForCompare(value: string): string {

46+

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

47+

}

48+
49+

function isValidBase64Payload(value: string): boolean {

50+

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

51+

return normalizeBase64ForCompare(buffer.toString("base64")) === normalizeBase64ForCompare(value);

52+

}

53+
4554

export class TwilioStreamFrameAdapter implements StreamFrameAdapter {

4655

readonly providerName = "twilio" as const;

4756

private streamSid = "";

@@ -71,7 +80,7 @@ export class TwilioStreamFrameAdapter implements StreamFrameAdapter {

7180

? (msg.media as Record<string, unknown>)

7281

: undefined;

7382

const payload = typeof mediaData?.payload === "string" ? mediaData.payload : undefined;

74-

if (!payload) {

83+

if (!payload || !isValidBase64Payload(payload)) {

7584

return { kind: "ignored" };

7685

}

7786

return {

@@ -151,7 +160,7 @@ export class TelnyxStreamFrameAdapter implements StreamFrameAdapter {

151160

? (msg.media as Record<string, unknown>)

152161

: undefined;

153162

const payload = typeof mediaData?.payload === "string" ? mediaData.payload : undefined;

154-

if (!payload) {

163+

if (!payload || !isValidBase64Payload(payload)) {

155164

return { kind: "ignored" };

156165

}

157166

return {