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

推荐订阅源

D
Docker
小众软件
小众软件
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
酷 壳 – CoolShell
酷 壳 – CoolShell
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
人人都是产品经理
人人都是产品经理
大猫的无限游戏
大猫的无限游戏
V
V2EX
阮一峰的网络日志
阮一峰的网络日志
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - Franky
WordPress大学
WordPress大学
有赞技术团队
有赞技术团队
Hugging Face - Blog
Hugging Face - Blog
Jina AI
Jina AI
博客园 - 聂微东
S
SegmentFault 最新的问题
量子位
宝玉的分享
宝玉的分享
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园_首页

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: narrow Gateway proxy bypass target (#77018) · opencl...
jesse-merhi · 2026-05-06 · via Recent Commits to openclaw:main

@@ -33,8 +33,10 @@ class MockWebSocket {

3333

terminateCalls = 0;

3434

autoCloseOnClose = true;

3535

readyState = MockWebSocket.CONNECTING;

36+

readonly options: unknown;

363737-

constructor(_url: string, _options?: unknown) {

38+

constructor(_url: string, options?: unknown) {

39+

this.options = options;

3840

wsInstances.push(this);

3941

}

4042

@@ -179,17 +181,36 @@ beforeAll(async () => {

179181

});

180182181183

describe("GatewayClient security checks", () => {

182-

const envSnapshot = captureEnv(["OPENCLAW_ALLOW_INSECURE_PRIVATE_WS"]);

184+

const envSnapshot = captureEnv([

185+

"OPENCLAW_ALLOW_INSECURE_PRIVATE_WS",

186+

"OPENCLAW_PROXY_ACTIVE",

187+

"OPENCLAW_PROXY_LOOPBACK_MODE",

188+

"HTTP_PROXY",

189+

"GLOBAL_AGENT_HTTP_PROXY",

190+

"GLOBAL_AGENT_FORCE_GLOBAL_AGENT",

191+

]);

183192184193

beforeEach(() => {

185194

envSnapshot.restore();

186195

delete process.env.OPENCLAW_ALLOW_INSECURE_PRIVATE_WS;

196+

delete process.env.OPENCLAW_PROXY_ACTIVE;

197+

delete process.env.OPENCLAW_PROXY_LOOPBACK_MODE;

198+

delete process.env.HTTP_PROXY;

199+

delete process.env.GLOBAL_AGENT_HTTP_PROXY;

200+

delete process.env.GLOBAL_AGENT_FORCE_GLOBAL_AGENT;

201+

delete (global as Record<string, unknown>)["GLOBAL_AGENT"];

187202

wsInstances.length = 0;

188203

});

189204190205

afterEach(() => {

191206

envSnapshot.restore();

192207

delete process.env.OPENCLAW_ALLOW_INSECURE_PRIVATE_WS;

208+

delete process.env.OPENCLAW_PROXY_ACTIVE;

209+

delete process.env.OPENCLAW_PROXY_LOOPBACK_MODE;

210+

delete process.env.HTTP_PROXY;

211+

delete process.env.GLOBAL_AGENT_HTTP_PROXY;

212+

delete process.env.GLOBAL_AGENT_FORCE_GLOBAL_AGENT;

213+

delete (global as Record<string, unknown>)["GLOBAL_AGENT"];

193214

});

194215195216

it("blocks ws:// to non-loopback addresses (CWE-319)", () => {

@@ -232,9 +253,82 @@ describe("GatewayClient security checks", () => {

232253233254

expect(onConnectError).not.toHaveBeenCalled();

234255

expect(wsInstances.length).toBe(1); // WebSocket created

256+

expect(getLatestWs().options).not.toHaveProperty("agent");

235257

client.stop();

236258

});

237259260+

it("bootstraps inherited managed proxy routing before proxy-mode loopback WebSocket creation", () => {

261+

process.env.OPENCLAW_PROXY_ACTIVE = "1";

262+

process.env.OPENCLAW_PROXY_LOOPBACK_MODE = "proxy";

263+

process.env.HTTP_PROXY = "http://127.0.0.1:3128";

264+

process.env.GLOBAL_AGENT_HTTP_PROXY = "http://127.0.0.1:3128";

265+

const onConnectError = vi.fn();

266+

const client = new GatewayClient({

267+

url: "ws://127.0.0.1:18789",

268+

onConnectError,

269+

});

270+271+

client.start();

272+273+

expect(onConnectError).not.toHaveBeenCalled();

274+

expect(wsInstances.length).toBe(1);

275+

expect(getLatestWs().options).not.toMatchObject({ agent: expect.any(Object) });

276+

expect((global as Record<string, unknown>)["GLOBAL_AGENT"]).toEqual(

277+

expect.objectContaining({

278+

HTTP_PROXY: "http://127.0.0.1:3128",

279+

HTTPS_PROXY: "http://127.0.0.1:3128",

280+

}),

281+

);

282+

client.stop();

283+

});

284+285+

it("proxies ws:// loopback addresses when active proxy loopbackMode is proxy", async () => {

286+

const { startProxy, stopProxy } = await import("../infra/net/proxy/proxy-lifecycle.js");

287+

const handle = await startProxy({

288+

enabled: true,

289+

proxyUrl: "http://127.0.0.1:3128",

290+

loopbackMode: "proxy",

291+

});

292+

const onConnectError = vi.fn();

293+

const client = new GatewayClient({

294+

url: "ws://127.0.0.1:18789",

295+

onConnectError,

296+

});

297+298+

try {

299+

client.start();

300+301+

expect(onConnectError).not.toHaveBeenCalled();

302+

expect(wsInstances.length).toBe(1);

303+

expect(getLatestWs().options).not.toMatchObject({ agent: expect.any(Object) });

304+

} finally {

305+

client.stop();

306+

await stopProxy(handle);

307+

}

308+

});

309+310+

it("blocks ws:// loopback addresses when active proxy loopbackMode is block", async () => {

311+

const { startProxy, stopProxy } = await import("../infra/net/proxy/proxy-lifecycle.js");

312+

const handle = await startProxy({

313+

enabled: true,

314+

proxyUrl: "http://127.0.0.1:3128",

315+

loopbackMode: "block",

316+

});

317+

const onConnectError = vi.fn();

318+

const client = new GatewayClient({

319+

url: "ws://127.0.0.1:18789",

320+

onConnectError,

321+

});

322+323+

try {

324+

expect(() => client.start()).toThrow("blocked by proxy.loopbackMode");

325+

expect(wsInstances.length).toBe(0);

326+

} finally {

327+

client.stop();

328+

await stopProxy(handle);

329+

}

330+

});

331+238332

it("allows wss:// to any address", () => {

239333

const onConnectError = vi.fn();

240334

const client = new GatewayClient({