Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(browser-extension): only the verified official plugin sends raw DevTools commands through the pipe
Dashe70e0eec609a
diff --git a/apps/desktop/src/main/cindy-brain/__tests__/browserExtensionSlot.test.ts b/apps/desktop/src/main/cindy-brain/__tests__/browserExtensionSlot.test.tsindex f6b068271d..55c4c60d4f 100644--- a/apps/desktop/src/main/cindy-brain/__tests__/browserExtensionSlot.test.ts+++ b/apps/desktop/src/main/cindy-brain/__tests__/browserExtensionSlot.test.ts@@ -390,6 +390,22 @@ describe('browserExtensionSlot · 管子上行', () => {expect(await slot.handleRequest('_root__my-browser', { kind: 'status' })).toMatchObject({ ok: true });});+ // Review 2026-10-30 (Codex P1): raw DevTools commands from a plugin that is not the verified official one.+ it('非官方插件不能经管子发原始 DevTools 命令', async () => {+ const payload = { kind: 'act', action: 'cdp', payload: { url: 'https://example.test', tabId: 1, op: 'command', method: 'DOM.setFileInputFiles', params: { files: ['/etc/hosts'] } } };+ const other = [extGhost({ id: 'other-browser', nativeHost: false })];+ const a = await makeSlot({}, other);+ a.slot.reconcile(other);+ await a.settle();+ expect(await a.slot.handleRequest('_root__other-browser', payload)).toMatchObject({ ok: false, errorCode: 'INVALID_REQUEST' });+ expect(a.bridges[0].calls.some(([name]) => name === 'act')).toBe(false);+ const official = await makeSlot();+ official.slot.reconcile(official.ghosts);+ await official.settle();+ await official.slot.handleRequest('_root__my-browser', payload);+ expect(official.bridges[0].calls.some(([name]) => name === 'act')).toBe(true);+ });+// Review 2026-10-30 (Codex P1): a plugin cannot name host paths for Chrome to open.it('插件管子不能按路径上传', async () => {const { slot, bridges, settle, ghosts } = await makeSlot();diff --git a/apps/desktop/src/main/cindy-brain/browserExtensionSlot.ts b/apps/desktop/src/main/cindy-brain/browserExtensionSlot.tsindex 1896b7edba..961a9267ea 100644--- a/apps/desktop/src/main/cindy-brain/browserExtensionSlot.ts+++ b/apps/desktop/src/main/cindy-brain/browserExtensionSlot.ts@@ -72,13 +72,13 @@ export function mayInstallNativeHost(ghost: InstalledGhost, verified = true): bo}/** 「我的浏览器」只由官方 Cindy Chrome 提供;其它插件声明 pageControl 一律忽略(2026-10-30 决定)。 */+/** The root instance of an official plugin id whose source was verified. */+function isOfficialInstance(ghost: InstalledGhost, verified: boolean): boolean {+ return verified && ghost.namespace == null && OFFICIAL_NATIVE_HOSTS.has(ghost.manifest.id);+}+export function mayProvidePageControl(ghost: InstalledGhost, verified = true): boolean {- return (- verified &&- ghost.manifest.browserExtension?.pageControl === true &&- ghost.namespace == null &&- OFFICIAL_NATIVE_HOSTS.has(ghost.manifest.id)- );+ return ghost.manifest.browserExtension?.pageControl === true && isOfficialInstance(ghost, verified);}export interface BrowserExtensionSlotDeps {@@ -401,6 +401,10 @@ export class GhostBrowserExtensionSlot {'paths' in req.payload)return fail('INVALID_REQUEST', 'upload by path is not available to plugins');+ // Raw DevTools commands can make Chrome open any host path (DOM.setFileInputFiles) or read+ // any page state, so only the verified official plugin may send them through the pipe.+ if (req.action === 'cdp' && !isOfficialInstance(entry.ghost, this.deps.isVerifiedOfficial(entry.ghost)))+ return fail('INVALID_REQUEST', 'raw DevTools commands are not available to this plugin');return (await entry.bridge.act(req.action,req.payload ?? {},