[Bug] 登录态下静默上传工作区完整 .git 历史到云端(含 objects/reflog),设置项无法关闭
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 22
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
提交前确认 · Pre-submission checklist
- 我已搜索过现有 issue,确认这不是重复 / I searched existing issues and confirmed this isn't a duplicate.(已搜
上传/git/snapshot/checkpoints,未见同类「静默上传完整 .git」反馈) - 我已阅读 CONTRIBUTING.md / I've read CONTRIBUTING.md.
问题类别 · Category
其他 / 不确定 · Other / Not sure(隐私 / 遥测 / 数据上传 · Privacy / telemetry)
涉及的 Agent 框架 · Agent framework
ZCode Agent(自研)
严重程度 · Severity
阻塞使用 · Blocking(在未明确告知与未获同意的情况下,将完整 Git 历史与本地配置外传,属于严重隐私问题;无法继续信任默认登录态使用)
复现频率 · Reproducibility
必现 · Always(只要桌面端处于登录态,对本机已出现 ~/.zcode/v2/checkpoints 与 lastAcceptedManifestHash 的工作区即可复核)
问题描述 · Description
请解释:为什么要在用户不知情的情况下,把工作区的完整 .git 数据(含 objects / logs / reflog 等)打包上传到云端?
本机自查发现:ZCode Desktop 在已登录前提下,会在发 Prompt / 任务结束时对工作区做 repo snapshot,内容不仅包含工作区文件,还包含整棵 .git 元数据目录,并出现 OSS 接受成功的本地痕迹。相关行为也已有社区公开讨论(例如 linux.do 相关帖)。
关键点:
- 门槛几乎只有登录 JWT:有
zcodeJwtToken/accessToken就会走上传;未见清晰的一次性同意弹窗或可理解的产品说明。 - 设置项挡不住:本机
~/.zcode/v2/setting.json中repoSnapshotIndexingEnabled已为false,仍出现成功上传痕迹(lastAcceptedManifestHash)。 .git被优先整包纳入:本地repo_snapshot_manifest/v2清单中可见大量.git/objects、.git/logs、.git/refs等路径;非 git 文件还有 1MiB 上限,但.git内部文件不受该限制约束(与社区逆向结论一致)。- 影响面:完整 Git 历史可能含已删除机密、历史 commit 中的密钥、内部仓库结构、作者邮箱、reflog 中的本地路径等;另会附带用户级 MCP / hooks / skills / AGENTS.md 等全局配置快照。
这不是「偶发日志误传」,而是可复现的本地状态机产物。
复现步骤 · Steps to reproduce
- 安装并登录 ZCode Desktop(本机复现版本见下;登录后凭证会出现在
~/.zcode/v2/credentials.json)。 - 打开一个含真实
.git目录的工作区,正常发送若干 Prompt / 完成任务。 - 检查目录是否存在:
~/.zcode/v2/checkpoints/。 - 查看各工作区
state.json:若出现lastAcceptedManifestHash,表示至少有一次快照已被远端接受。 - 打开对应
manifests/*.json(schema =repo_snapshot_manifest/v2),统计files[].path中以.git/开头的条目。
本机最小自查命令(macOS / Linux):
ls ~/.zcode/v2/checkpoints
# 若存在 lastAcceptedManifestHash = 曾成功上传
python3 -c "
import json, pathlib
base=pathlib.Path.home()/'.zcode'/'v2'/'checkpoints'
for st in base.rglob('state.json'):
d=json.load(open(st))
print(st.parent.name, 'accepted=', bool(d.get('lastAcceptedManifestHash')),
'ws=', d.get('workspaceKey'))
"
期望表现 · Expected behavior
- 默认不上传任何工作区源码或
.git历史;若确有「Repo Wiki / 索引」类云端能力,必须:- 首次明确告知上传范围(是否含
.git、全局配置、prompt 正文); - 默认关闭,需用户显式 opt-in;
- 提供一键关闭,且关闭后立即停止抓取与 pending flush。
- 首次明确告知上传范围(是否含
- 永远不要把完整
.git(objects / reflog / config)作为默认快照内容;即便 opt-in,也应排除 secrets / git 内部对象,或仅上传当前 tree 的必要索引。 - 隐私政策 / 产品文档中清楚写明该行为;设置里的相关开关名与真实行为一致。
- 对已上传数据提供删除/导出说明。
实际表现 · Actual behavior
- 登录后即可上传;
repoSnapshotIndexingEnabled: false不能阻止。 - 本机多个工作区出现
lastAcceptedManifestHash;其中至少一个真实 git 仓库的 accepted manifest 含 两千+ 条.git/*路径(含objects/logs等)。 - 另有工作区生成过接近 1GB 的 pending
*.tar.gz.enc(内含大量.git文件);失败计数很高,说明客户端会持续尝试,而不是偶发一次。 - Linux 远程桌面实例(3.10.0)同样存在
checkpoints与lastAcceptedManifestHash(该次 manifest 中.git体量较小,但上传链路同样触发)。
ZCode 版本 · ZCode version
- macOS Desktop:3.12.3(
3.12.3.7463) - Linux Desktop(远程):3.10.0
设备 / 系统 / 浏览器 · Device / OS / Browser
- macOS(Darwin),ZCode.app
- Linux CentOS 7,ZCode Desktop(Electron 解包部署)
截图 / 录屏 / 日志 · Screenshots / Recordings / Logs
不在此粘贴完整 manifest / 工作区路径 / 任何 token。可复核的本地证据形态:
- 目录:
~/.zcode/v2/checkpoints/<hash>/state.json含lastAcceptedManifestHash - 清单:同目录
manifests/*.json,schema: repo_snapshot_manifest/v2,files中大量.git/... - 设置:
repoSnapshotIndexingEnabled: false仍出现 accepted hash - 社区分析线索:https://linux.do/t/topic/2918098
如需私密渠道补充更细的本机样本,可走仓库 SECURITY 政策中的 Private Vulnerability Reporting;本 issue 先公开请求产品层解释与默认关闭/可关闭修复。
想请维护者回答的问题
- 上传完整
.git的产品目的是什么?与「Repo Wiki / 体验优化」的关系是什么? - 为什么在
repoSnapshotIndexingEnabled = false时仍会上传? - 隐私政策哪一条覆盖了「完整 Git 历史 + 全局 Agent 配置」的外传?
- 用户如何彻底关闭,以及如何申请删除已经上传的数据?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the behavior from ~/.zcode/v2/checkpoints, comparing state.json, manifests/*.json, and ~/.zcode/v2/setting.json with repoSnapshotIndexingEnabled set to false. Trace the desktop snapshot and upload entry points that produce lastAcceptedManifestHash and include .git paths. Done means the default path does not upload workspace or .git data, the setting stops pending uploads, and the user-facing privacy and deletion guidance is accurate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, git
- Domain
- cloud, desktop, security
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100