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

推荐订阅源

Hugging Face - Blog
Hugging Face - Blog
Google DeepMind News
Google DeepMind News
云风的 BLOG
云风的 BLOG
WordPress大学
WordPress大学
Vercel News
Vercel News
Apple Machine Learning Research
Apple Machine Learning Research
T
Tailwind CSS Blog
I
InfoQ
小众软件
小众软件
Recent Announcements
Recent Announcements
博客园 - 【当耐特】
The GitHub Blog
The GitHub Blog
大猫的无限游戏
大猫的无限游戏
美团技术团队
T
The Blog of Author Tim Ferriss
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell
MongoDB | Blog
MongoDB | Blog
V
V2EX
J
Java Code Geeks
有赞技术团队
有赞技术团队
博客园 - 聂微东
B
Blog RSS Feed
博客园 - 司徒正美

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: reject symlinked whatsapp creds · openclaw/openclaw@...
mcaxtr · 2026-05-21 · via Recent Commits to openclaw:main

@@ -3,10 +3,15 @@ import fs from "node:fs/promises";

33

import path from "node:path";

44

import { beforeEach, describe, expect, it, vi } from "vitest";

55

import {

6+

getWebAuthAgeMs,

7+

hasWebCredsSync,

68

logoutWeb,

79

pickWebChannel,

10+

readCredsJsonRaw,

811

readWebAuthSnapshot,

912

readWebAuthState,

13+

readWebSelfId,

14+

readWebSelfIdentity,

1015

restoreCredsFromBackupIfNeeded,

1116

webAuthExists,

1217

WhatsAppAuthUnstableError,

@@ -86,6 +91,29 @@ describe("auth-store", () => {

8691

});

8792

});

889394+

it("preserves valid large creds instead of treating them as corrupt", async () => {

95+

const authDir = createTempAuthDir("openclaw-wa-auth-large-creds");

96+

const credsPath = path.join(authDir, "creds.json");

97+

const largeCreds = JSON.stringify({

98+

me: { id: "15551234567@s.whatsapp.net" },

99+

additionalData: "x".repeat(1024 * 1024 + 512),

100+

});

101+

fsSync.writeFileSync(credsPath, largeCreds, "utf-8");

102+

fsSync.writeFileSync(

103+

path.join(authDir, "creds.json.bak"),

104+

JSON.stringify({ me: { id: "19990000000@s.whatsapp.net" } }),

105+

"utf-8",

106+

);

107+108+

await expect(webAuthExists(authDir)).resolves.toBe(true);

109+

await expect(restoreCredsFromBackupIfNeeded(authDir)).resolves.toBe(false);

110+

expect(fsSync.readFileSync(credsPath, "utf-8")).toBe(largeCreds);

111+

expect(readWebSelfId(authDir)).toMatchObject({

112+

e164: "+15551234567",

113+

jid: "15551234567@s.whatsapp.net",

114+

});

115+

});

116+89117

it("refuses to restore creds from a symlinked backup path", async () => {

90118

const authDir = createTempAuthDir("openclaw-wa-auth-restore-symlink");

91119

const targetPath = path.join(authDir, "backup-target.json");

@@ -99,6 +127,27 @@ describe("auth-store", () => {

99127

expect(fsSync.readFileSync(credsPath, "utf-8")).toBe("{");

100128

});

101129130+

it.runIf(process.platform !== "win32")(

131+

"does not restore backup over a symlinked creds path",

132+

async () => {

133+

const authDir = createTempAuthDir("openclaw-wa-auth-restore-target-symlink");

134+

const targetPath = path.join(authDir, "target-creds.json");

135+

const credsPath = path.join(authDir, "creds.json");

136+

const backupPath = path.join(authDir, "creds.json.bak");

137+

fsSync.writeFileSync(targetPath, "{", "utf-8");

138+

fsSync.symlinkSync(targetPath, credsPath);

139+

fsSync.writeFileSync(

140+

backupPath,

141+

JSON.stringify({ me: { id: "123@s.whatsapp.net" } }),

142+

"utf-8",

143+

);

144+145+

await expect(restoreCredsFromBackupIfNeeded(authDir)).resolves.toBe(false);

146+

expect(fsSync.lstatSync(credsPath).isSymbolicLink()).toBe(true);

147+

expect(fsSync.readFileSync(targetPath, "utf-8")).toBe("{");

148+

},

149+

);

150+102151

it("reports linked auth state and snapshot from the shared read helper", async () => {

103152

const authDir = createTempAuthDir("openclaw-wa-auth-linked");

104153

fsSync.writeFileSync(

@@ -122,6 +171,64 @@ describe("auth-store", () => {

122171

});

123172

});

124173174+

it.runIf(process.platform !== "win32")(

175+

"treats symlinked creds as missing across auth readers",

176+

async () => {

177+

const authDir = createTempAuthDir("openclaw-wa-auth-symlink-read");

178+

const targetPath = path.join(authDir, "target-creds.json");

179+

const credsPath = path.join(authDir, "creds.json");

180+

fsSync.writeFileSync(

181+

targetPath,

182+

JSON.stringify({ me: { id: "15551234567@s.whatsapp.net" } }),

183+

"utf-8",

184+

);

185+

fsSync.symlinkSync(targetPath, credsPath);

186+187+

expect(fsSync.lstatSync(credsPath).isSymbolicLink()).toBe(true);

188+

expect(fsSync.statSync(credsPath).isFile()).toBe(true);

189+

expect(hasWebCredsSync(authDir)).toBe(false);

190+

expect(readCredsJsonRaw(credsPath)).toBeNull();

191+

expect(getWebAuthAgeMs(authDir)).toBeNull();

192+

expect(readWebSelfId(authDir)).toEqual({ e164: null, jid: null, lid: null });

193+

await expect(readWebSelfIdentity(authDir)).resolves.toEqual({

194+

e164: null,

195+

jid: null,

196+

lid: null,

197+

});

198+

await expect(webAuthExists(authDir)).resolves.toBe(false);

199+

await expect(readWebAuthState(authDir)).resolves.toBe("not-linked");

200+

await expect(readWebAuthSnapshot(authDir)).resolves.toEqual({

201+

state: "not-linked",

202+

authAgeMs: null,

203+

selfId: { e164: null, jid: null, lid: null },

204+

});

205+

},

206+

);

207+208+

it.runIf(process.platform !== "win32")(

209+

"treats creds under a symlinked auth directory as missing",

210+

async () => {

211+

const rootDir = createTempAuthDir("openclaw-wa-auth-symlink-parent");

212+

const targetAuthDir = path.join(rootDir, "target-auth");

213+

const authDir = path.join(rootDir, "linked-auth");

214+

fsSync.mkdirSync(targetAuthDir);

215+

fsSync.writeFileSync(

216+

path.join(targetAuthDir, "creds.json"),

217+

JSON.stringify({ me: { id: "15551234567@s.whatsapp.net" } }),

218+

"utf-8",

219+

);

220+

fsSync.symlinkSync(targetAuthDir, authDir, "dir");

221+

const credsPath = path.join(authDir, "creds.json");

222+223+

expect(fsSync.lstatSync(authDir).isSymbolicLink()).toBe(true);

224+

expect(fsSync.lstatSync(credsPath).isFile()).toBe(true);

225+

expect(hasWebCredsSync(authDir)).toBe(false);

226+

expect(readCredsJsonRaw(credsPath)).toBeNull();

227+

await expect(webAuthExists(authDir)).resolves.toBe(false);

228+

await expect(readWebAuthState(authDir)).resolves.toBe("not-linked");

229+

},

230+

);

231+125232

it("reports unstable auth state when the shared barrier read times out", async () => {

126233

const authDir = createTempAuthDir("openclaw-wa-auth-unstable-state");

127234

fsSync.writeFileSync(