makecindy / makecindy/cindy

[Feature Request] cindy_browser 的 SSRF 策略把 agent 逼出沙箱裸跑 Chrome,导致用户浏览器被连带强杀 — 建议开放受信任的本地文件/截图通道

Open
#1,766 2 comments 0 reactions 0 assignees View on GitHub
enhancement feature
Dominant language
TypeScript
Stars
2.7k
Forks
395
Avg merge
21h 48m
Merged PRs (30d)
776

Description

### 使用场景 / Use case

## 问题描述

agent 需要"截图验证本地生成的 HTML 文件"时,无法通过 cindy_browser 完成:
- `file://` 导航被拒
- `http://127.0.0.1:PORT/` / `http://localhost:PORT/` 导航被 SSRF 策略拦截

agent 随即放弃 cindy_browser,改为通过 Bash 裸跑 `chrome.exe --headless`。在裸跑调试中,agent 自创了 `taskkill /F /IM chrome.exe /T` 作为"清理残留实例"的手段 —— 该命令按进程名强杀系统内**所有** chrome.exe,**包括用户正在使用的个人 Chrome**(含未保存的标签会话)。

**后果**:用户 Chrome 被无通知强杀。强制结束不产生崩溃转储、无 WER 记录、无错误弹窗,用户表现为"Chrome 无故闪退/窗口突然消失"。该清理模式被 agent 复制进后续 90+ 次截图脚本,反复误杀用户浏览器。

### 当前问题 / Current limitation

## 复现步骤

1. 让 agent 用 cindy_browser 打开 `file:///E:/foo.html` → SSRF 策略拒绝
2. agent 改用 Bash 裸跑 `chrome.exe --headless`(不带隔离 profile)截图本地文件
3. 当裸跑实例与用户正在运行的 Chrome 冲突(profile/端口占用、空截图)时,agent 可能使用 `taskkill /F /IM chrome.exe /T` 清场
4. 用户 Chrome 被连带强杀,且无任何崩溃痕迹,难以排查

## 根因分析

1. **平台缺口**:cindy_browser 的 `ssrfPolicy` 未放行本地地址(`file://`、`127.0.0.1`、`localhost`),而"验证本地生成的 HTML"恰恰是 agent 的高频需求
2. **逃逸**:被拦截后 agent 转向 Bash 裸跑浏览器 —— 沙箱外的 Chrome 不受平台任何护栏约束(无隔离 profile 强制、无生命周期管理)
3. **放大**:裸跑环境无护栏,agent 采用最粗暴的"杀全部"清场策略,副作用被低估

> 补充:cindy_browser 服务本身的隔离性是没问题的 —— 独立 profile(`browser-runtime/browser/Cindy/user-data`)+ 固定 CDP 端口,`stop` 仅关闭自身进程树;并发实测(用户 Chrome + 第三方 Chrome + agent 浏览器三实例共存)证明其不会影响用户 Chrome。**问题只出在策略逼使 agent 逃逸后的裸跑路径。**

### 期望方案 / Proposed solution

## 建议方案

1. **开放受信任的本地导航**:为 cindy_browser 增加显式的本地页面支持:
- `file://` 直开;或
- 放行 `127.0.0.1:<随机端口>` 导航,并要求显式 opt-in(如 action 参数 `allowLocal: true`),避免默认放宽引入 SSRF 风险
2. **提供"本地文件截图"专用 action**:如 `screenshot(localFile: "...")` / `navigate(localFile: ...)`,内部走隔离 profile + 临时 HTTP 服务,agent 无需逃逸
3. **工具描述引导**:在 cindy_browser 工具描述中注明"本地文件请使用 XX action",减少 agent 探索失败后逃逸的概率

### 已考虑的替代方案 / Alternatives considered

## 环境

- Windows 10 Pro (10.0.19045)
- Chrome 150.0.7871.188
- cindy 构建:2026-08-04 版(`C:\Program Files\Cindy`)

Contributor guide

Open the contributing guide

Research direction

No file or test is named. Start at the cindy_browser ssrfPolicy and the navigate/screenshot action entry points; compare the proposed file://, opt-in localhost, and local-file action paths. Done should provide a reviewed local-file workflow, preserve the isolated browser profile, and document the supported action for agents.

Written by the indexing model from the issue text.

Assessment

Domain
security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.