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

推荐订阅源

阮一峰的网络日志
阮一峰的网络日志
博客园 - 司徒正美
D
DataBreaches.Net
宝玉的分享
宝玉的分享
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 【当耐特】
人人都是产品经理
人人都是产品经理
博客园 - Franky
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
IT之家
IT之家
博客园 - 三生石上(FineUI控件)
J
Java Code Geeks
腾讯CDC
博客园_首页
The Cloudflare Blog
S
SegmentFault 最新的问题
C
Check Point Blog
美团技术团队
爱范儿
爱范儿
大猫的无限游戏
大猫的无限游戏
Hugging Face - Blog
Hugging Face - Blog
T
The Blog of Author Tim Ferriss
A
About on SuperTechFans
Blog — PlanetScale
Blog — PlanetScale

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(foundry): wrap malformed az token json · openclaw/ope...
vincentkoc · 2026-05-14 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

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

5353

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

5454

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

5555

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

56+

- Microsoft Foundry: report malformed Azure CLI token JSON with owned auth errors instead of leaking raw parser failures.

5657

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

5758

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

5859

- 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

@@ -85,23 +85,32 @@ export function isAzCliInstalled(): boolean {

8585
8686

export function getLoggedInAccount(): AzAccount | null {

8787

try {

88-

return JSON.parse(execAz(["account", "show", "--output", "json"])) as AzAccount;

88+

return parseAzJson(execAz(["account", "show", "--output", "json"]), "account") as AzAccount;

8989

} catch {

9090

return null;

9191

}

9292

}

9393
9494

export function listSubscriptions(): AzAccount[] {

9595

try {

96-

const subs = JSON.parse(

96+

const subs = parseAzJson(

9797

execAz(["account", "list", "--output", "json", "--all"]),

98+

"subscriptions",

9899

) as AzAccount[];

99100

return subs.filter((sub) => sub.state === "Enabled");

100101

} catch {

101102

return [];

102103

}

103104

}

104105
106+

function parseAzJson(raw: string, label: string): unknown {

107+

try {

108+

return JSON.parse(raw) as unknown;

109+

} catch {

110+

throw new Error(`Azure CLI returned malformed ${label} JSON.`);

111+

}

112+

}

113+
105114

type AccessTokenParams = {

106115

subscriptionId?: string;

107116

tenantId?: string;

@@ -125,13 +134,16 @@ function buildAccessTokenArgs(params?: AccessTokenParams): string[] {

125134

}

126135
127136

export function getAccessTokenResult(params?: AccessTokenParams): AzAccessToken {

128-

return JSON.parse(execAz(buildAccessTokenArgs(params))) as AzAccessToken;

137+

return parseAzJson(execAz(buildAccessTokenArgs(params)), "access token") as AzAccessToken;

129138

}

130139
131140

export async function getAccessTokenResultAsync(

132141

params?: AccessTokenParams,

133142

): Promise<AzAccessToken> {

134-

return JSON.parse(await execAzAsync(buildAccessTokenArgs(params))) as AzAccessToken;

143+

return parseAzJson(

144+

await execAzAsync(buildAccessTokenArgs(params)),

145+

"access token",

146+

) as AzAccessToken;

135147

}

136148
137149

export async function azLoginDeviceCode(): Promise<void> {

Original file line numberDiff line numberDiff line change

@@ -235,6 +235,19 @@ function mockAzureCliToken(params: { accessToken: string; expiresInMs: number; d

235235

);

236236

}

237237
238+

function mockAzureCliTokenRaw(stdout: string) {

239+

execFileMock.mockImplementationOnce(

240+

(

241+

_file: unknown,

242+

_args: unknown,

243+

_options: unknown,

244+

callback: (error: Error | null, stdout: string, stderr: string) => void,

245+

) => {

246+

callback(null, stdout, "");

247+

},

248+

);

249+

}

250+
238251

function mockAzureCliLoginFailure(delayMs?: number) {

239252

execFileMock.mockImplementationOnce(

240253

(

@@ -306,6 +319,14 @@ describe("microsoft-foundry plugin", () => {

306319

expect(config.auth?.order?.["microsoft-foundry"]).toEqual(["microsoft-foundry:default"]);

307320

});

308321
322+

it("reports malformed Azure CLI token JSON with an owned error", async () => {

323+

mockAzureCliTokenRaw("{not json");

324+
325+

await expect(getAccessTokenResultAsync()).rejects.toThrow(

326+

"Azure CLI returned malformed access token JSON.",

327+

);

328+

});

329+
309330

it("fails clearly when the selected Azure subscription is not in the enabled list", async () => {

310331

const provider = registerProvider();

311332

execFileSyncMock.mockImplementation((_file: string, args: string[]) => {