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): plugins cannot upload by path; an ambiguous profile abbreviation is refused; recheck paths before Chrome reads them
Dash2e1fee23f21a
diff --git a/apps/desktop/src/main/cindy-brain/__tests__/browserExtensionSlot.test.ts b/apps/desktop/src/main/cindy-brain/__tests__/browserExtensionSlot.test.tsindex 02b9721fb7..cc25b2aa7d 100644--- a/apps/desktop/src/main/cindy-brain/__tests__/browserExtensionSlot.test.ts+++ b/apps/desktop/src/main/cindy-brain/__tests__/browserExtensionSlot.test.ts@@ -369,6 +369,20 @@ describe('browserExtensionSlot · 管子上行', () => {expect(again.sent.some(([, payload]) => (payload as { name?: string }).name === 'browser-extension-policy-request')).toBe(false);});+ // 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();+ slot.reconcile(ghosts);+ await settle();+ const refused = await slot.handleRequest('_root__my-browser', {+ kind: 'act',+ action: 'upload',+ payload: { url: 'https://example.test', tabId: 1, selector: 'input', paths: ['/etc/hosts'] },+ });+ expect(refused).toMatchObject({ ok: false, errorCode: 'INVALID_REQUEST' });+ expect(bridges[0].calls.some(([name]) => name === 'act')).toBe(false);+ });+// Review 2026-10-30 (Codex P1): a manifest that merely claims the official id must not get the native// host, My browser or saved pairings.it('未核验来源的包不装 native host、不接管「我的浏览器」、不继承配对', async () => {diff --git a/apps/desktop/src/main/cindy-brain/browserExtensionSlot.ts b/apps/desktop/src/main/cindy-brain/browserExtensionSlot.tsindex cfe36f1b11..445d9a967c 100644--- a/apps/desktop/src/main/cindy-brain/browserExtensionSlot.ts+++ b/apps/desktop/src/main/cindy-brain/browserExtensionSlot.ts@@ -373,6 +373,15 @@ export class GhostBrowserExtensionSlot {};}case 'act':+ // Uploads by path are Cindy's own: the task's folder boundary and approval were checked by+ // the host before it asked Chrome to read the file. A plugin cannot name host paths.+ if (+ req.action === 'upload' &&+ req.payload &&+ typeof req.payload === 'object' &&+ 'paths' in req.payload+ )+ return fail('INVALID_REQUEST', 'upload by path is not available to plugins');return (await entry.bridge.act(req.action,req.payload ?? {},diff --git a/apps/desktop/src/main/mcp-integrations/browser-backend/__tests__/user-browser-backend.test.ts b/apps/desktop/src/main/mcp-integrations/browser-backend/__tests__/user-browser-backend.test.tsindex 8c8a5a29c2..c31940be09 100644--- a/apps/desktop/src/main/mcp-integrations/browser-backend/__tests__/user-browser-backend.test.ts+++ b/apps/desktop/src/main/mcp-integrations/browser-backend/__tests__/user-browser-backend.test.ts@@ -669,6 +669,23 @@ describe('UserBrowserBackend · 读取与动作', () => {}});+ // Review 2026-10-30 (Codex P1): an abbreviated profile that matches two connections must not pick one.+ it('缩写的 profile 匹配多个连接时拒绝,精确 id 优先', async () => {+ const fake = fakeControl({+ clients: ['client-aaaa1111', 'client-aaaa2222', 'client-aaaa'],+ tabs: { 'client-aaaa': [{ id: 1, url: 'https://b.test/' }] },+ });+ const b = backend(fake.control);+ expect(await call(b, { action: 'open', url: 'https://b.test/', profile: 'client-aaa' })).toMatchObject({+ ok: false,+ message: expect.stringContaining('匹配多个'),+ });+ expect(await call(b, { action: 'open', url: 'https://b.test/', profile: 'client-aaaa' })).toMatchObject({+ ok: true,+ data: { browser: 'client-aaaa' },+ });+ });+it('按需调试:PDF 交给扩展;未授权时告诉模型请用户在已打开的说明页里确认', async () => {const fake = fakeControl({ version: '0.4.43' });let granted = false;diff --git a/apps/desktop/src/main/mcp-integrations/browser-backend/user-browser-backend.ts b/apps/desktop/src/main/mcp-integrations/browser-backend/user-browser-backend.tsindex 8530e6bc08..d209f54575 100644--- a/apps/desktop/src/main/mcp-integrations/browser-backend/user-browser-backend.ts+++ b/apps/desktop/src/main/mcp-integrations/browser-backend/user-browser-backend.ts@@ -412,7 +412,20 @@ export class UserBrowserBackend implements BrowserBackend {result: actionFailed(action, DISCONNECTED_MESSAGE, 'BROWSER_RUNTIME_UNAVAILABLE'),};if (profile) {- const found = clients.find((c) => c.id === profile || c.id.startsWith(profile));+ // An exact id wins; an abbreviation must match exactly one connection, or the action could land in+ // another signed-in browser.+ const exact = clients.filter((c) => c.id === profile);+ const matches = exact.length ? exact : clients.filter((c) => c.id.startsWith(profile));+ if (matches.length > 1)+ return {+ ok: false,+ result: actionFailed(+ action,+ `浏览器连接 ${profile} 匹配多个连接,请写得更完整;用 profiles 查看当前连接`,+ 'BROWSER_RUNTIME_INVALID_REQUEST',+ ),+ };+ const found = matches[0];if (!found)return {ok: false,@@ -1310,6 +1323,14 @@ export class UserBrowserBackend implements BrowserBackend {mimeType: UPLOAD_MIME[path.extname(file).toLowerCase()] ?? '',});}+ if (byPath) {+ // Chrome opens the files by path itself (no transfer bound), so this is the one place the check+ // and the read are apart. Check again just before handing the paths over to keep that gap small;+ // accepted trade-off (2026-10-30): the debugger route is weaker than reading the bytes here.+ const again = await resolveUploadFiles(paths, roots);+ if (again.some((file, i) => file !== paths[i]))+ return actionFailed(req.action, '上传文件在检查后发生了变化,请重试', 'BROWSER_RUNTIME_INVALID_REQUEST');+ }const ref = req.inputRef ?? req.ref;const job = await this.pageJob(gate.control, record, 'upload', {...(ref ? { ref } : req.selector ? { selector: req.selector } : { selector: 'input[type=file]' }),