Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(browser): switching to the user's own browser goes through session approval

Dash2ffc7168713b
diff --git a/apps/desktop/src/main/maker-host/__tests__/mcpToolApprovalPolicy.test.ts b/apps/desktop/src/main/maker-host/__tests__/mcpToolApprovalPolicy.test.ts
index 0b57ae36c8..7ab30454c9 100644
--- a/apps/desktop/src/main/maker-host/__tests__/mcpToolApprovalPolicy.test.ts
+++ b/apps/desktop/src/main/maker-host/__tests__/mcpToolApprovalPolicy.test.ts
@@ -121,6 +121,23 @@ describe('desktop MCP approval policy', () => {
})).toBe('auto-approve');
}
});
+ // #7875 security review: a page could steer the agent into switching to the user's own browser, so
+ // that switch goes through session approval; switching to Cindy's own browsers stays quiet.
+ it('reviews switching to the user\'s own browser', () => {
+ const toUser = { action: 'setBackend', backend: 'user-browser' };
+ for (const toolName of ['call_tool', undefined]) {
+ expect(getDesktopMcpToolApprovalPolicy({ serverName: 'cindy_browser', toolName,
+ toolParams: { name: 'browser', args: JSON.stringify(toUser) },
+ })).toBe('prompt-each-time');
+ }
+ expect(getDesktopMcpToolApprovalPolicy({ serverName: 'cindy_browser', toolName: 'browser', toolParams: toUser }))
+ .toBe('prompt-each-time');
+ for (const backend of ['external', 'rsb-webview']) {
+ expect(getDesktopMcpToolApprovalPolicy({ serverName: 'cindy_browser', toolName: 'call_tool',
+ toolParams: { name: 'browser', args: { action: 'setBackend', backend } },
+ })).toBe('auto-approve');
+ }
+ });
it('never lets import discovery grant reusable approval to start a migration', () => {
for (const operation of ['sources', 'preview', 'status', 'start', undefined]) {
for (const toolName of ['import_agent', undefined]) {
diff --git a/apps/desktop/src/main/maker-host/mcp-tool-approval-policy.ts b/apps/desktop/src/main/maker-host/mcp-tool-approval-policy.ts
index 86197c23a2..194a2f1cd0 100644
--- a/apps/desktop/src/main/maker-host/mcp-tool-approval-policy.ts
+++ b/apps/desktop/src/main/maker-host/mcp-tool-approval-policy.ts
@@ -220,6 +220,11 @@ export function getDesktopMcpToolApprovalPolicy(
const args = progressive ? readJsonObject(params?.args) : params;
if ((name === 'browser' && args?.action === 'recipe')
|| (progressive && (!name || !args))) return 'prompt-each-time';
+ // Switching to the user's own browser hands the agent their signed-in Chrome/Edge tabs; a page could
+ // ask the agent to do it. The switch goes through the session's approval like a recipe; the user
+ // choosing My browser in Settings needs no tool call and so no approval.
+ if (name === 'browser' && args?.action === 'setBackend' && args.backend === 'user-browser')
+ return 'prompt-each-time';
}
if (serverName === 'cindy' && toolName === 'ghost_market_install') return 'prompt-each-time';
// This bridge multiplexes independent imported connections and commands with