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

推荐订阅源

爱范儿
爱范儿
博客园_首页
U
Unit 42
Apple Machine Learning Research
Apple Machine Learning Research
云风的 BLOG
云风的 BLOG
MongoDB | Blog
MongoDB | Blog
美团技术团队
H
Help Net Security
G
Google Developers Blog
B
Blog RSS Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
aimingoo的专栏
aimingoo的专栏
Google DeepMind News
Google DeepMind News
J
Java Code Geeks
M
MIT News - Artificial intelligence
腾讯CDC
IT之家
IT之家
Vercel News
Vercel News
C
Check Point Blog
博客园 - 三生石上(FineUI控件)
Last Week in AI
Last Week in AI
I
InfoQ
博客园 - 司徒正美
A
About on SuperTechFans

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(browser): guard current tab act routes (#78523) · ope...
eleqtrizit · 2026-05-19 · via Recent Commits to openclaw:main

@@ -70,7 +70,11 @@ describe("existing-session interaction navigation guard", () => {

7070

for (const fn of Object.values(navigationGuardMocks)) {

7171

fn.mockClear();

7272

}

73+

navigationGuardMocks.assertBrowserNavigationResultAllowed.mockImplementation(

74+

async (_opts?: { url: string; ssrfPolicy?: unknown }) => {},

75+

);

7376

chromeMcpMocks.evaluateChromeMcpScript.mockResolvedValue("https://example.com");

77+

routeState.tab.url = "https://example.com";

7478

routeState.profileCtx.listTabs.mockReset();

7579

routeState.profileCtx.listTabs.mockResolvedValue([

7680

{

@@ -136,11 +140,10 @@ describe("existing-session interaction navigation guard", () => {

136140

expect(clickResponse.statusCode).toBe(200);

137141

expect(typeResponse.statusCode).toBe(200);

138142

expect(chromeMcpMocks.clickChromeMcpElement).toHaveBeenCalledOnce();

139-

const keyPressCalls = chromeMcpMocks.pressChromeMcpKey.mock.calls as unknown as Array<

140-

[{ key?: string }]

141-

>;

142-

expect(keyPressCalls[0]?.[0]?.key).toBe("Enter");

143-

expectNavigationProbeUrls(Array.from({ length: 6 }, () => "https://example.com"));

143+

expect(chromeMcpMocks.pressChromeMcpKey).toHaveBeenCalledWith(

144+

expect.objectContaining({ key: "Enter" }),

145+

);

146+

expectNavigationProbeUrls(Array.from({ length: 8 }, () => "https://example.com"));

144147

});

145148146149

it("rechecks the page url after delayed navigation-triggering interactions", async () => {

@@ -155,12 +158,32 @@ describe("existing-session interaction navigation guard", () => {

155158

expect(response.statusCode).toBe(200);

156159

expect(chromeMcpMocks.evaluateChromeMcpScript).toHaveBeenCalledTimes(4);

157160

expectNavigationProbeUrls([

161+

"https://example.com",

158162

"https://example.com",

159163

"http://169.254.169.254/latest/meta-data/",

160164

"http://169.254.169.254/latest/meta-data/",

161165

]);

162166

});

163167168+

it("blocks evaluate before execution when the current tab URL is disallowed", async () => {

169+

routeState.tab.url = "http://169.254.169.254/latest/meta-data/";

170+

navigationGuardMocks.assertBrowserNavigationResultAllowed.mockImplementation(

171+

async (opts?: { url: string }) => {

172+

const url = opts?.url ?? "";

173+

if (url.includes("169.254.169.254")) {

174+

throw new Error("blocked current tab");

175+

}

176+

},

177+

);

178+179+

await expectActionToThrow(

180+

{ kind: "evaluate", fn: "() => document.body.innerText" },

181+

"blocked current tab",

182+

);

183+

expect(chromeMcpMocks.evaluateChromeMcpScript).not.toHaveBeenCalled();

184+

expectNavigationProbeUrls(["http://169.254.169.254/latest/meta-data/"]);

185+

});

186+164187

it("checks URLs for tabs opened during the interaction window", async () => {

165188

routeState.profileCtx.listTabs

166189

.mockResolvedValueOnce([

@@ -188,6 +211,7 @@ describe("existing-session interaction navigation guard", () => {

188211

"https://example.com",

189212

"https://example.com",

190213

"https://example.com",

214+

"https://example.com",

191215

"http://169.254.169.254/latest/meta-data/",

192216

]);

193217

});

@@ -231,7 +255,7 @@ describe("existing-session interaction navigation guard", () => {

231255

.mockResolvedValueOnce(" " as never);

232256233257

await expectActionToReject({ kind: "evaluate", fn: "() => 1" });

234-

expect(navigationGuardMocks.assertBrowserNavigationResultAllowed).not.toHaveBeenCalled();

258+

expectNavigationProbeUrls(["https://example.com"]);

235259

});

236260237261

it("fails closed when a later post-action probe becomes unreadable", async () => {

@@ -243,7 +267,7 @@ describe("existing-session interaction navigation guard", () => {

243267

.mockResolvedValueOnce(undefined as never); // follow-up probe - still unreadable

244268245269

await expectActionToReject({ kind: "evaluate", fn: "() => 1" });

246-

expectNavigationProbeUrls(["https://example.com"]);

270+

expectNavigationProbeUrls(["https://example.com", "https://example.com"]);

247271

});

248272249273

it("confirms stability via follow-up probe when URL changes on the last loop iteration", async () => {

@@ -265,6 +289,7 @@ describe("existing-session interaction navigation guard", () => {

265289

// 1 action call + 5 location probes (3 in loop + 1 failed + 1 follow-up)

266290

expect(chromeMcpMocks.evaluateChromeMcpScript).toHaveBeenCalledTimes(5);

267291

expectNavigationProbeUrls([

292+

"https://example.com",

268293

"https://example.com",

269294

"https://safe-redirect.com",

270295

"https://safe-redirect.com",

@@ -284,6 +309,7 @@ describe("existing-session interaction navigation guard", () => {

284309

expect(response.statusCode).toBe(200);

285310

expect(chromeMcpMocks.evaluateChromeMcpScript).toHaveBeenCalledTimes(5);

286311

expectNavigationProbeUrls([

312+

"https://example.com",

287313

"https://example.com",

288314

"https://example.com",

289315

"https://safe-redirect.com",

@@ -313,7 +339,11 @@ describe("existing-session interaction navigation guard", () => {

313339

.mockRejectedValueOnce(new Error("context destroyed") as never); // follow-up → still errored

314340315341

await expectActionToReject({ kind: "evaluate", fn: "() => 1" });

316-

expectNavigationProbeUrls(["https://example.com", "https://example.com"]);

342+

expectNavigationProbeUrls([

343+

"https://example.com",

344+

"https://example.com",

345+

"https://example.com",

346+

]);

317347

});

318348319349

it("skips the guard when no SSRF policy is configured", async () => {