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

推荐订阅源

WordPress大学
WordPress大学
J
Java Code Geeks
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
腾讯CDC
IT之家
IT之家
罗磊的独立博客
酷 壳 – CoolShell
酷 壳 – CoolShell
U
Unit 42
爱范儿
爱范儿
博客园 - 聂微东
F
Fortinet All Blogs
V
Visual Studio Blog
Blog — PlanetScale
Blog — PlanetScale
G
Google Developers Blog
aimingoo的专栏
aimingoo的专栏
L
LangChain Blog
雷峰网
雷峰网
B
Blog RSS Feed
宝玉的分享
宝玉的分享
T
Tailwind CSS Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Engineering at Meta
Engineering at Meta
H
Hackread – Cybersecurity News, Data Breaches, AI and 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(agents): redact oauth refresh errors · openclaw/openc...
vincentkoc · 2026-05-17 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -153,6 +153,40 @@ describe("OAuthManagerRefreshError", () => {

153153

expect(serialized).not.toContain("store-access");

154154

expect(serialized).not.toContain("store-refresh");

155155

});

156+
157+

it("redacts credential secrets from the refresh error message", () => {

158+

const refreshedStore: AuthProfileStore = {

159+

version: 1,

160+

profiles: {

161+

"openai-codex:default": createCredential({

162+

access: "store-access",

163+

refresh: "store-refresh",

164+

idToken: "store-id-token",

165+

}),

166+

},

167+

};

168+

const error = new OAuthManagerRefreshError({

169+

credential: createCredential({

170+

access: "error-access",

171+

refresh: "error-refresh",

172+

idToken: "error-id-token",

173+

}),

174+

profileId: "openai-codex:default",

175+

refreshedStore,

176+

cause: new Error(

177+

"refresh rejected error-access error-refresh error-id-token store-access store-refresh store-id-token",

178+

),

179+

});

180+
181+

expect(error.message).toContain("refresh rejected");

182+

expect(error.message).not.toContain("error-access");

183+

expect(error.message).not.toContain("error-refresh");

184+

expect(error.message).not.toContain("error-id-token");

185+

expect(error.message).not.toContain("store-access");

186+

expect(error.message).not.toContain("store-refresh");

187+

expect(error.message).not.toContain("store-id-token");

188+

expect(error.message.match(/\[redacted\]/g)?.length).toBe(6);

189+

});

156190

});

157191
158192

describe("createOAuthManager", () => {

Original file line numberDiff line numberDiff line change

@@ -80,10 +80,17 @@ export class OAuthManagerRefreshError extends Error {

8080

structuredCause?.code === "refresh_contention" && structuredCause.cause

8181

? structuredCause.cause

8282

: params.cause;

83-

super(

84-

`OAuth token refresh failed for ${params.credential.provider}: ${formatErrorMessage(params.cause)}`,

85-

{ cause: delegatedCause },

83+

const storedCredential = params.refreshedStore.profiles[params.profileId];

84+

const causeMessage = redactOAuthCredentialSecrets(

85+

formatErrorMessage(params.cause),

86+

collectOAuthCredentialSecrets(

87+

params.credential,

88+

storedCredential?.type === "oauth" ? storedCredential : undefined,

89+

),

8690

);

91+

super(`OAuth token refresh failed for ${params.credential.provider}: ${causeMessage}`, {

92+

cause: delegatedCause,

93+

});

8794

this.name = "OAuthManagerRefreshError";

8895

this.#credential = params.credential;

8996

this.profileId = params.profileId;

@@ -154,6 +161,28 @@ function canReuseOAuthCredentialAfterRefreshFailure(params: {

154161

return !params.forceRefresh || hasOAuthCredentialChanged(params.attempted, params.candidate);

155162

}

156163
164+

function collectOAuthCredentialSecrets(

165+

...credentials: Array<OAuthCredential | undefined>

166+

): string[] {

167+

const secrets = new Set<string>();

168+

for (const credential of credentials) {

169+

for (const secret of [credential?.access, credential?.refresh, credential?.idToken]) {

170+

if (secret) {

171+

secrets.add(secret);

172+

}

173+

}

174+

}

175+

return Array.from(secrets);

176+

}

177+
178+

function redactOAuthCredentialSecrets(message: string, secrets: string[]): string {

179+

let redacted = message;

180+

for (const secret of secrets) {

181+

redacted = redacted.split(secret).join("[redacted]");

182+

}

183+

return redacted;

184+

}

185+
157186

async function loadFreshStoredOAuthCredential(params: {

158187

profileId: string;

159188

agentDir?: string;