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

推荐订阅源

Martin Fowler
Martin Fowler
Jina AI
Jina AI
J
Java Code Geeks
Microsoft Security Blog
Microsoft Security Blog
Recent Announcements
Recent Announcements
I
InfoQ
L
LangChain Blog
The Cloudflare Blog
IT之家
IT之家
博客园 - 叶小钗
Apple Machine Learning Research
Apple Machine Learning Research
B
Blog
A
About on SuperTechFans
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Last Week in AI
Last Week in AI
Blog — PlanetScale
Blog — PlanetScale
罗磊的独立博客
云风的 BLOG
云风的 BLOG
Microsoft Azure Blog
Microsoft Azure Blog
Engineering at Meta
Engineering at Meta
F
Fortinet All Blogs
博客园 - 聂微东
美团技术团队
博客园_首页

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
refactor: share browser route navigation policy · opencla...
vincentkoc · 2026-05-29 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -64,6 +64,18 @@ export function resolveProfileContext(

6464

return profileCtx;

6565

}

6666
67+

export function browserNavigationPolicyForProfile(

68+

ctx: BrowserRouteContext,

69+

profileCtx: ProfileContext,

70+

) {

71+

return withBrowserNavigationPolicy(ctx.state().resolved.ssrfPolicy, {

72+

browserProxyMode: resolveBrowserNavigationProxyMode({

73+

resolved: ctx.state().resolved,

74+

profile: profileCtx.profile,

75+

}),

76+

});

77+

}

78+
6779

export async function getPwAiModule(): Promise<PwAiModule | null> {

6880

return await getPwAiModuleBase({ mode: "soft" });

6981

}

@@ -124,12 +136,7 @@ export async function withRouteTabContext<T>(

124136

if (params.enforceCurrentUrlAllowed) {

125137

await assertBrowserNavigationResultAllowed({

126138

url: tab.url,

127-

...withBrowserNavigationPolicy(params.ctx.state().resolved.ssrfPolicy, {

128-

browserProxyMode: resolveBrowserNavigationProxyMode({

129-

resolved: params.ctx.state().resolved,

130-

profile: profileCtx.profile,

131-

}),

132-

}),

139+

...browserNavigationPolicyForProfile(params.ctx, profileCtx),

133140

});

134141

}

135142

return await params.run({

@@ -169,12 +176,7 @@ export async function resolveSafeRouteTabUrl(params: {

169176

try {

170177

await assertBrowserNavigationResultAllowed({

171178

url: candidateUrl,

172-

...withBrowserNavigationPolicy(params.ctx.state().resolved.ssrfPolicy, {

173-

browserProxyMode: resolveBrowserNavigationProxyMode({

174-

resolved: params.ctx.state().resolved,

175-

profile: params.profileCtx.profile,

176-

}),

177-

}),

179+

...browserNavigationPolicyForProfile(params.ctx, params.profileCtx),

178180

});

179181

return candidateUrl;

180182

} catch {

Original file line numberDiff line numberDiff line change

@@ -71,6 +71,9 @@ vi.mock("../../media/store.js", () => ({

7171

}));

7272
7373

vi.mock("./agent.shared.js", () => ({

74+

browserNavigationPolicyForProfile: vi.fn(() => ({

75+

ssrfPolicy: { dangerouslyAllowPrivateNetwork: false },

76+

})),

7477

getPwAiModule: vi.fn(async () => null),

7578

handleRouteError: vi.fn(

7679

(

Original file line numberDiff line numberDiff line change

@@ -64,6 +64,7 @@ vi.mock("../../media/store.js", () => ({

6464

}));

6565
6666

vi.mock("./agent.shared.js", () => ({

67+

browserNavigationPolicyForProfile: vi.fn(() => ({})),

6768

getPwAiModule: vi.fn(async () => null),

6869

handleRouteError: vi.fn((_ctx, _res, err) => {

6970

throw err;

Original file line numberDiff line numberDiff line change

@@ -1,6 +1,5 @@

11

import path from "node:path";

22

import { ensureMediaDir, saveMediaBuffer } from "../../media/store.js";

3-

import { resolveBrowserNavigationProxyMode } from "../browser-proxy-mode.js";

43

import { captureScreenshot, snapshotAria, snapshotRoleViaCdp } from "../cdp.js";

54

import {

65

evaluateChromeMcpScript,

@@ -18,16 +17,16 @@ import {

1817

assertBrowserNavigationAllowed,

1918

assertBrowserNavigationResultAllowed,

2019

} from "../navigation-guard.js";

21-

import { withBrowserNavigationPolicy } from "../navigation-guard.js";

2220

import { getBrowserProfileCapabilities } from "../profile-capabilities.js";

2321

import {

2422

DEFAULT_BROWSER_SCREENSHOT_MAX_BYTES,

2523

DEFAULT_BROWSER_SCREENSHOT_MAX_SIDE,

2624

normalizeBrowserScreenshot,

2725

} from "../screenshot.js";

28-

import type { BrowserRouteContext, ProfileContext } from "../server-context.js";

26+

import type { BrowserRouteContext } from "../server-context.js";

2927

import { normalizeBrowserTimerDelayMs } from "../timer-delay.js";

3028

import {

29+

browserNavigationPolicyForProfile,

3130

getPwAiModule,

3231

handleRouteError,

3332

readBody,

@@ -49,15 +48,6 @@ import { asyncBrowserRoute, jsonError, toBoolean, toStringOrEmpty } from "./util

4948
5049

const CHROME_MCP_OVERLAY_ATTR = "data-openclaw-mcp-overlay";

5150
52-

function browserNavigationPolicyForProfile(ctx: BrowserRouteContext, profileCtx: ProfileContext) {

53-

return withBrowserNavigationPolicy(ctx.state().resolved.ssrfPolicy, {

54-

browserProxyMode: resolveBrowserNavigationProxyMode({

55-

resolved: ctx.state().resolved,

56-

profile: profileCtx.profile,

57-

}),

58-

});

59-

}

60-
6151

async function collectChromeMcpSnapshotUrls(params: {

6252

profileName: string;

6353

profile?: ChromeMcpProfileOptions;

Original file line numberDiff line numberDiff line change

@@ -31,6 +31,9 @@ export const existingSessionRouteState = {

3131
3232

export function createExistingSessionAgentSharedModule() {

3333

return {

34+

browserNavigationPolicyForProfile: vi.fn((ctx: BrowserRouteContext) =>

35+

withBrowserNavigationPolicy(ctx.state().resolved.ssrfPolicy),

36+

),

3437

getPwAiModule: vi.fn(async () => null),

3538

handleRouteError: vi.fn((_ctx: BrowserRouteContext, res: BrowserResponse, err: unknown) => {

3639

const message = err instanceof Error ? err.message : String(err);

Original file line numberDiff line numberDiff line change

@@ -1,5 +1,4 @@

11

import { parseStrictNonNegativeInteger } from "openclaw/plugin-sdk/number-runtime";

2-

import { resolveBrowserNavigationProxyMode } from "../browser-proxy-mode.js";

32

import {

43

BrowserProfileUnavailableError,

54

BrowserTabNotFoundError,

@@ -12,30 +11,9 @@ import {

1211

} from "../navigation-guard.js";

1312

import type { BrowserRouteContext, ProfileContext } from "../server-context.js";

1413

import { resolveTargetIdFromTabs } from "../target-id.js";

14+

import { browserNavigationPolicyForProfile, resolveProfileContext } from "./agent.shared.js";

1515

import type { BrowserRequest, BrowserResponse, BrowserRouteRegistrar } from "./types.js";

16-

import { asyncBrowserRoute, getProfileContext, jsonError, toStringOrEmpty } from "./utils.js";

17-
18-

function resolveTabsProfileContext(

19-

req: BrowserRequest,

20-

res: BrowserResponse,

21-

ctx: BrowserRouteContext,

22-

) {

23-

const profileCtx = getProfileContext(req, ctx);

24-

if ("error" in profileCtx) {

25-

jsonError(res, profileCtx.status, profileCtx.error);

26-

return null;

27-

}

28-

return profileCtx;

29-

}

30-
31-

function browserNavigationPolicyForProfile(ctx: BrowserRouteContext, profileCtx: ProfileContext) {

32-

return withBrowserNavigationPolicy(ctx.state().resolved.ssrfPolicy, {

33-

browserProxyMode: resolveBrowserNavigationProxyMode({

34-

resolved: ctx.state().resolved,

35-

profile: profileCtx.profile,

36-

}),

37-

});

38-

}

16+

import { asyncBrowserRoute, jsonError, toStringOrEmpty } from "./utils.js";

3917
4018

function handleTabsRouteError(

4119

ctx: BrowserRouteContext,

@@ -59,7 +37,7 @@ async function withTabsProfileRoute(params: {

5937

mapTabError?: boolean;

6038

run: (profileCtx: ProfileContext) => Promise<void>;

6139

}) {

62-

const profileCtx = resolveTabsProfileContext(params.req, params.res, params.ctx);

40+

const profileCtx = resolveProfileContext(params.req, params.res, params.ctx);

6341

if (!profileCtx) {

6442

return;

6543

}