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

推荐订阅源

MongoDB | Blog
MongoDB | Blog
J
Java Code Geeks
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
D
DataBreaches.Net
腾讯CDC
GbyAI
GbyAI
I
InfoQ
博客园 - Franky
G
Google Developers Blog
Last Week in AI
Last Week in AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
V
Visual Studio Blog
Vercel News
Vercel News
博客园_首页
MyScale Blog
MyScale Blog
Martin Fowler
Martin Fowler
N
Netflix TechBlog - Medium
V
V2EX
T
The Blog of Author Tim Ferriss
M
MIT News - Artificial intelligence
雷峰网
雷峰网
H
Hackread – Cybersecurity News, Data Breaches, AI and More
大猫的无限游戏
大猫的无限游戏
The GitHub Blog
The GitHub Blog

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(msteams): wrap malformed api json · openclaw/openclaw...
vincentkoc · 2026-05-15 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

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

8585

- Brave Search: report malformed web and LLM-context API JSON with provider-owned errors instead of leaking raw parser failures.

8686

- xAI tools: report malformed web search, X search, and code execution JSON with provider-owned errors instead of leaking raw parser failures.

8787

- Nextcloud Talk: report malformed room-info and bot-admin JSON with channel-owned errors instead of leaking raw parser failures.

88+

- Microsoft Teams: report malformed Graph and delegated OAuth JSON with channel-owned errors instead of leaking raw parser failures.

8889

- Twilio voice-call: report malformed successful API JSON responses with provider-owned errors instead of leaking raw parser failures.

8990

- Voice-call provider APIs: report malformed successful guarded JSON responses with provider-prefixed errors instead of leaking raw parser failures.

9091

- Realtime transcription: report malformed provider websocket JSON frames with owned parser errors instead of leaking raw `SyntaxError` objects.

Original file line numberDiff line numberDiff line change

@@ -193,6 +193,19 @@ describe("msteams graph helpers", () => {

193193

}),

194194

"Graph /teams/team-1/channels failed (403): forbidden",

195195

);

196+
197+

mockTextFetchResponse("{ nope", {

198+

status: 200,

199+

headers: { "content-type": "application/json" },

200+

});

201+
202+

await expectRejectsToThrow(

203+

fetchGraphJson({

204+

token: graphToken,

205+

path: "/teams/team-1/channels",

206+

}),

207+

"Graph /teams/team-1/channels failed: malformed JSON response",

208+

);

196209

});

197210
198211

it("posts Graph JSON to v1 and beta roots and treats empty mutation responses as undefined", async () => {

Original file line numberDiff line numberDiff line change

@@ -1,3 +1,4 @@

1+

import { readProviderJsonResponse } from "openclaw/plugin-sdk/provider-http";

12

import { fetchWithSsrFGuard, type MSTeamsConfig } from "../runtime-api.js";

23

import { GRAPH_ROOT } from "./attachments/shared.js";

34

@@ -118,7 +119,7 @@ export async function fetchGraphAbsoluteUrl<T>(params: {

118119

`Graph ${params.url} failed (${response.status}): ${text || "unknown error"}`,

119120

);

120121

}

121-

return (await response.json()) as T;

122+

return await readProviderJsonResponse<T>(response, `Graph ${params.url} failed`);

122123

} finally {

123124

await release();

124125

}

Original file line numberDiff line numberDiff line change

@@ -228,6 +228,25 @@ describe("exchangeMSTeamsCodeForTokens", () => {

228228

}),

229229

).rejects.toThrow(/MSTeams token exchange failed \(400\)/);

230230

});

231+
232+

it("reports malformed token exchange JSON with a stable OAuth error", async () => {

233+

fetchSpy.mockResolvedValueOnce(

234+

new Response("{ nope", {

235+

status: 200,

236+

headers: { "Content-Type": "application/json" },

237+

}),

238+

);

239+
240+

await expect(

241+

exchangeMSTeamsCodeForTokens({

242+

tenantId: "t",

243+

clientId: "c",

244+

clientSecret: "s", // pragma: allowlist secret

245+

code: "bad-json",

246+

verifier: "v",

247+

}),

248+

).rejects.toThrow("MSTeams token exchange failed: malformed JSON response");

249+

});

231250

});

232251
233252

describe("refreshMSTeamsDelegatedTokens", () => {

@@ -310,4 +329,22 @@ describe("refreshMSTeamsDelegatedTokens", () => {

310329

}),

311330

).rejects.toThrow(/MSTeams token refresh failed \(401\)/);

312331

});

332+
333+

it("reports malformed token refresh JSON with a stable OAuth error", async () => {

334+

fetchSpy.mockResolvedValueOnce(

335+

new Response("{ nope", {

336+

status: 200,

337+

headers: { "Content-Type": "application/json" },

338+

}),

339+

);

340+
341+

await expect(

342+

refreshMSTeamsDelegatedTokens({

343+

tenantId: "t",

344+

clientId: "c",

345+

clientSecret: "s", // pragma: allowlist secret

346+

refreshToken: "bad-json",

347+

}),

348+

).rejects.toThrow("MSTeams token refresh failed: malformed JSON response");

349+

});

313350

});

Original file line numberDiff line numberDiff line change

@@ -1,3 +1,4 @@

1+

import { readProviderJsonResponse } from "openclaw/plugin-sdk/provider-http";

12

import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/ssrf-runtime";

23

import {

34

MSTEAMS_DEFAULT_DELEGATED_SCOPES,

@@ -65,7 +66,10 @@ async function fetchMSTeamsTokens(params: {

6566

const errorText = await response.text();

6667

throw new Error(`MSTeams ${params.failureLabel} failed (${response.status}): ${errorText}`);

6768

}

68-

return (await response.json()) as MSTeamsTokenResponse;

69+

return await readProviderJsonResponse<MSTeamsTokenResponse>(

70+

response,

71+

`MSTeams ${params.failureLabel} failed`,

72+

);

6973

} finally {

7074

await release();

7175

}