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

推荐订阅源

雷峰网
雷峰网
MongoDB | Blog
MongoDB | Blog
D
Docker
Martin Fowler
Martin Fowler
人人都是产品经理
人人都是产品经理
GbyAI
GbyAI
Jina AI
Jina AI
酷 壳 – CoolShell
酷 壳 – CoolShell
M
MIT News - Artificial intelligence
腾讯CDC
阮一峰的网络日志
阮一峰的网络日志
H
Hackread – Cybersecurity News, Data Breaches, AI and More
N
Netflix TechBlog - Medium
B
Blog RSS Feed
云风的 BLOG
云风的 BLOG
Blog — PlanetScale
Blog — PlanetScale
Vercel News
Vercel News
The Cloudflare Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
有赞技术团队
有赞技术团队
G
Google Developers Blog
Stack Overflow Blog
Stack Overflow Blog
I
InfoQ
U
Unit 42

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): redact chrome mcp attach details · openclaw...
vincentkoc · 2026-05-17 · via Recent Commits to openclaw:main

@@ -1,4 +1,6 @@

11

import fs from "node:fs/promises";

2+

import os from "node:os";

3+

import path from "node:path";

24

import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";

35

import {

46

clickChromeMcpElement,

@@ -119,6 +121,7 @@ describe("chrome MCP page parsing", () => {

119121120122

afterEach(() => {

121123

vi.useRealTimers();

124+

vi.unstubAllEnvs();

122125

});

123126124127

it("parses list_pages text responses when structuredContent is missing", async () => {

@@ -232,25 +235,56 @@ describe("chrome MCP page parsing", () => {

232235233236

it("redacts remote CDP URL secrets from attach failures", async () => {

234237

const secretToken = "browserless-secret-token-1234567890"; // pragma: allowlist secret

235-

const cdpUrl = `wss://browserless.example/chrome?token=${secretToken}`;

238+

const user = "browser-user";

239+

const password = "browser-password-1234567890"; // pragma: allowlist secret

240+

const cdpUrl = `wss://${user}:${password}@browserless.example/chrome?token=${secretToken}`;

241+

const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-chrome-mcp-test-"));

242+

const configPath = path.join(tempDir, "openclaw.json");

243+

await fs.writeFile(configPath, JSON.stringify({ logging: { redactSensitive: "off" } }));

244+

vi.stubEnv("OPENCLAW_CONFIG_PATH", configPath);

245+

const fakeMcpCommand = path.join(tempDir, "fake-mcp.mjs");

246+

await fs.writeFile(

247+

fakeMcpCommand,

248+

`#!/usr/bin/env node

249+

const cdpUrl = process.argv.find((arg) => arg.includes("browserless.example")) ?? "";

250+

let input = "";

251+

process.stdin.on("data", (chunk) => {

252+

input += chunk;

253+

const match = input.match(/"id"\\s*:\\s*(\\d+)/);

254+

if (!match) return;

255+

const body = JSON.stringify({

256+

jsonrpc: "2.0",

257+

id: Number(match[1]),

258+

error: { code: -32000, message: "attach failed for " + cdpUrl },

259+

});

260+

process.stdout.write(body + "\\n");

261+

});

262+

`,

263+

);

264+

await fs.chmod(fakeMcpCommand, 0o755);

236265237266

let message = "";

238267

try {

239268

await ensureChromeMcpAvailable(

240269

"remote-profile",

241270

{

242271

cdpUrl,

243-

mcpCommand: process.execPath,

244-

mcpArgs: ["-e", "process.exit(1)"],

272+

mcpCommand: fakeMcpCommand,

245273

},

246274

{ ephemeral: true },

247275

);

248276

} catch (err) {

249277

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

278+

} finally {

279+

await fs.rm(tempDir, { recursive: true, force: true });

250280

}

251281252282

expect(message).toContain("Chrome MCP existing-session attach failed");

283+

expect(message).toContain("attach failed");

253284

expect(message).toContain("browserless.example");

285+

expect(message).not.toContain(cdpUrl);

286+

expect(message).not.toContain(user);

287+

expect(message).not.toContain(password);

254288

expect(message).not.toContain(secretToken);

255289

});

256290