Skip to content

Commit 7af6608

Browse files
committed
fix(browser): keep CDP proxy bypass private
1 parent 6c1750f commit 7af6608

16 files changed

Lines changed: 143 additions & 33 deletions

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ Docs: https://docs.openclaw.ai
6262

6363
- Agents/subagents: report tool-only child progress during timeout summaries instead of showing no visible output.
6464
- Telegram/ACP: preserve explicit `:topic:` conversation suffixes when inbound ACP targets do not carry a separate thread id.
65+
- Browser/proxy: bypass the managed proxy for the exact local managed Chrome CDP readiness and DevTools WebSocket endpoints, so `openclaw browser start` works when the operator proxy blocks loopback egress. (#83255) Thanks @lightcap.
6566
- Ollama: bypass the managed proxy for configured local embedding origins while keeping SSRF guardrails on unconfigured targets. Thanks @Kaspre.
6667
- OpenAI/images: route Codex API-key image generation through the native OpenAI Images API instead of the Codex OAuth streaming backend, avoiding 401s from valid API keys.
6768
- Checks/Windows: route full `pnpm check` stage commands through the managed child runner so Windows avoids Node shell-argv deprecation warnings there too.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
434c62dfc32631e2c0cd862059f3257c0844d2c515e92db4d5670be7f3882a14 plugin-sdk-api-baseline.json
2-
2f6c82614fc6521ea27209e3d9888a4a6cdec30fa3082500aef4f8975358d9bf plugin-sdk-api-baseline.jsonl
1+
3edfe664353cb1e86496af1c88d2e9658e1910e31a0e3c016d462c46f449761e plugin-sdk-api-baseline.json
2+
510167f8b7e2f16db16d55aefb1f04dd27faa6f4340db765a88cffc4c8b874ff plugin-sdk-api-baseline.jsonl

‎docs/security/network-proxy.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ proxy:
9696
loopbackMode: gateway-only # gateway-only, proxy, or block
9797
```
9898

99-
- `gateway-only` (default): OpenClaw registers the Gateway loopback authority in Proxyline's managed bypass policy so local Gateway WebSocket traffic can connect directly. Custom loopback Gateway ports work because the active Gateway URL's host and port are registered. The bundled Ollama memory embedding provider can also use its own narrower guarded direct path for the exact configured host-local loopback embedding origin.
99+
- `gateway-only` (default): OpenClaw registers the Gateway loopback authority in Proxyline's managed bypass policy so local Gateway WebSocket traffic can connect directly. Custom loopback Gateway ports work because the active Gateway URL's host and port are registered. The bundled browser plugin can also register the exact local CDP readiness and DevTools WebSocket endpoints for OpenClaw-launched managed browsers, and the bundled Ollama memory embedding provider can use its own narrower guarded direct path for the exact configured host-local loopback embedding origin.
100100
- `proxy`: OpenClaw does not register Gateway or Ollama loopback bypasses, so that loopback traffic is sent through the managed proxy. If the proxy is remote, it must provide special routing for the OpenClaw host's loopback service, such as mapping it to a proxy-reachable hostname, IP, or tunnel. Standard remote proxies resolve `127.0.0.1` and `localhost` from the proxy host, not from the OpenClaw host.
101101
- `block`: OpenClaw denies Gateway loopback control-plane connections and guarded Ollama host-local embedding loopback connections before opening a socket.
102102

‎docs/tools/browser.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ Browser settings live in `~/.openclaw/openclaw.json`.
218218
- Browser navigation and open-tab are SSRF-guarded before navigation and best-effort re-checked on the final `http(s)` URL afterwards.
219219
- In strict SSRF mode, remote CDP endpoint discovery and `/json/version` probes (`cdpUrl`) are checked too.
220220
- Gateway/provider `HTTP_PROXY`, `HTTPS_PROXY`, `ALL_PROXY`, and `NO_PROXY` environment variables do not automatically proxy the OpenClaw-managed browser. Managed Chrome launches direct by default so provider proxy settings do not weaken browser SSRF checks.
221+
- OpenClaw-managed local CDP readiness probes and DevTools WebSocket connections bypass the managed network proxy for the exact launched loopback endpoint, so `openclaw browser start` still works when an operator proxy blocks loopback egress.
221222
- To proxy the managed browser itself, pass explicit Chrome proxy flags through `browser.extraArgs`, such as `--proxy-server=...` or `--proxy-pac-url=...`. Strict SSRF mode blocks explicit browser proxy routing unless private-network browser access is intentionally enabled.
222223
- `browser.ssrfPolicy.dangerouslyAllowPrivateNetwork` is off by default; enable only when private-network browser access is intentionally trusted.
223224
- `browser.ssrfPolicy.allowPrivateNetwork` remains supported as a legacy alias.

‎extensions/browser/src/browser/cdp-proxy-bypass.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const { registerManagedProxyBrowserCdpBypassMock } = vi.hoisted(() => ({
88
),
99
}));
1010

11-
vi.mock("openclaw/plugin-sdk/proxy-runtime", () => ({
11+
vi.mock("openclaw/plugin-sdk/ssrf-runtime-internal", () => ({
1212
registerManagedProxyBrowserCdpBypass: registerManagedProxyBrowserCdpBypassMock,
1313
}));
1414

‎extensions/browser/src/browser/cdp-proxy-bypass.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010
import http from "node:http";
1111
import https from "node:https";
12-
import { registerManagedProxyBrowserCdpBypass } from "openclaw/plugin-sdk/proxy-runtime";
12+
import { registerManagedProxyBrowserCdpBypass } from "openclaw/plugin-sdk/ssrf-runtime-internal";
1313
import { isLoopbackHost } from "../gateway/net.js";
1414
import { hasProxyEnvConfigured } from "../infra/net/proxy-env.js";
1515

‎extensions/browser/src/browser/cdp.helpers.internal.test.ts‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ vi.mock("openclaw/plugin-sdk/ssrf-runtime", async (importOriginal) => {
1717
};
1818
});
1919

20-
vi.mock("openclaw/plugin-sdk/proxy-runtime", () => ({
20+
vi.mock("openclaw/plugin-sdk/ssrf-runtime-internal", () => ({
2121
registerManagedProxyBrowserCdpBypass: registerManagedProxyBrowserCdpBypassMock,
2222
}));
2323

@@ -528,6 +528,21 @@ describe("openCdpWebSocket option handling", () => {
528528
ws.close();
529529
});
530530

531+
it("registers websocket managed-proxy bypass without URL credentials", () => {
532+
const release = vi.fn();
533+
registerManagedProxyBrowserCdpBypassMock.mockReturnValueOnce(release);
534+
const ws = openCdpWebSocket("ws://user:[email protected]:1/devtools/browser/X", {
535+
handshakeTimeoutMs: 500,
536+
});
537+
538+
expect(registerManagedProxyBrowserCdpBypassMock).toHaveBeenCalledWith(
539+
"ws://127.0.0.1:1/devtools/browser/X",
540+
);
541+
expect(release).toHaveBeenCalledOnce();
542+
ws.once("error", () => {});
543+
ws.close();
544+
});
545+
531546
it("omits the direct-loopback agent for non-loopback targets", () => {
532547
// Exercises the falsy side of `agent ? { agent } : {}` — the loopback
533548
// agent helper returns undefined for non-loopback hosts.

‎extensions/browser/src/browser/cdp.helpers.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,8 +483,9 @@ export function openCdpWebSocket(
483483
? Math.max(1, Math.floor(opts.handshakeTimeoutMs))
484484
: CDP_WS_HANDSHAKE_TIMEOUT_MS;
485485
const agent = getDirectAgentForCdp(wsUrl);
486+
const bypassUrl = stripUrlCredentials(wsUrl);
486487
return withManagedProxyForCdpUrl(
487-
wsUrl,
488+
bypassUrl,
488489
() =>
489490
new WebSocket(wsUrl, {
490491
handshakeTimeout: handshakeTimeoutMs,

‎extensions/browser/src/browser/chrome.internal.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const { registerManagedProxyBrowserCdpBypassMock } = vi.hoisted(() => ({
2525
),
2626
}));
2727

28-
vi.mock("openclaw/plugin-sdk/proxy-runtime", () => ({
28+
vi.mock("openclaw/plugin-sdk/ssrf-runtime-internal", () => ({
2929
registerManagedProxyBrowserCdpBypass: registerManagedProxyBrowserCdpBypassMock,
3030
}));
3131

‎package.json‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,6 @@
158158
"types": "./dist/plugin-sdk/proxy-capture.d.ts",
159159
"default": "./dist/plugin-sdk/proxy-capture.js"
160160
},
161-
"./plugin-sdk/proxy-runtime": {
162-
"types": "./dist/plugin-sdk/proxy-runtime.d.ts",
163-
"default": "./dist/plugin-sdk/proxy-runtime.js"
164-
},
165161
"./plugin-sdk/runtime-secret-resolution": {
166162
"types": "./dist/plugin-sdk/runtime-secret-resolution.d.ts",
167163
"default": "./dist/plugin-sdk/runtime-secret-resolution.js"

0 commit comments

Comments
 (0)