












@@ -125,6 +125,39 @@ describe("browser manage output", () => {
125125expect(output).not.toContain("port: 0");
126126});
127127128+it("redacts remote cdpUrl details in browser profiles output", async () => {
129+getBrowserManageCallBrowserRequestMock().mockImplementation(async (_opts: unknown, req) =>
130+req.path === "/profiles"
131+ ? {
132+profiles: [
133+{
134+name: "remote",
135+driver: "openclaw",
136+transport: "cdp",
137+running: true,
138+tabCount: 1,
139+isDefault: false,
140+isRemote: true,
141+cdpPort: null,
142+cdpUrl:
143+"https://alice:supersecretpasswordvalue1234@example.com/chrome?token=supersecrettokenvalue1234567890",
144+color: "#00AA00",
145+},
146+],
147+}
148+ : {},
149+);
150+151+const program = createBrowserManageProgram();
152+await program.parseAsync(["browser", "profiles"], { from: "user" });
153+154+const output = lastRuntimeLog();
155+expect(output).toContain("cdpUrl: https://example.com/chrome?token=supers…7890");
156+expect(output).not.toContain("alice");
157+expect(output).not.toContain("supersecretpasswordvalue1234");
158+expect(output).not.toContain("supersecrettokenvalue1234567890");
159+});
160+128161it("shows chrome-mcp transport after creating an existing-session profile", async () => {
129162getBrowserManageCallBrowserRequestMock().mockImplementation(async (_opts: unknown, req) =>
130163req.path === "/profiles/create"
@@ -153,6 +186,43 @@ describe("browser manage output", () => {
153186expect(output).not.toContain("port: 0");
154187});
155188189+it("redacts remote cdpUrl details after creating a remote profile", async () => {
190+getBrowserManageCallBrowserRequestMock().mockImplementation(async (_opts: unknown, req) =>
191+req.path === "/profiles/create"
192+ ? {
193+ok: true,
194+profile: "remote",
195+transport: "cdp",
196+cdpPort: null,
197+cdpUrl:
198+"https://alice:supersecretpasswordvalue1234@example.com/chrome?token=supersecrettokenvalue1234567890",
199+userDataDir: null,
200+color: "#00AA00",
201+isRemote: true,
202+}
203+ : {},
204+);
205+206+const program = createBrowserManageProgram();
207+await program.parseAsync(
208+[
209+"browser",
210+"create-profile",
211+"--name",
212+"remote",
213+"--cdp-url",
214+"https://alice:supersecretpasswordvalue1234@example.com/chrome?token=supersecrettokenvalue1234567890",
215+],
216+{ from: "user" },
217+);
218+219+const output = lastRuntimeLog();
220+expect(output).toContain("cdpUrl: https://example.com/chrome?token=supers…7890");
221+expect(output).not.toContain("alice");
222+expect(output).not.toContain("supersecretpasswordvalue1234");
223+expect(output).not.toContain("supersecrettokenvalue1234567890");
224+});
225+156226it("redacts sensitive remote cdpUrl details in status output", async () => {
157227getBrowserManageCallBrowserRequestMock().mockImplementation(async (_opts: unknown, req) =>
158228req.path === "/"
此內容由慣性聚合(RSS閱讀器)自動聚合整理,僅供閱讀參考。 原文來自 — 版權歸原作者所有。