From fa2d01aad2565d5f58df0dd3c7e45fc498b3c606 Mon Sep 17 00:00:00 2001 From: LittleGuo Date: Wed, 14 Oct 2026 19:08:49 +0800 Subject: [PATCH] =?UTF-8?q?docs(memory):=20=E5=A4=87=E6=A1=88=20DeepSeek?= =?UTF-8?q?=20API=20Key=20=E6=B3=84=E9=9C=B2=E4=B8=8E=E8=BD=AE=E6=8D=A2?= =?UTF-8?q?=E5=BE=85=E5=8A=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Key 已随 bdd77af 进入 git 历史并推送远程,删除文件无法清除历史, 须由用户去 DeepSeek 控制台轮换(仓库外人工操作)。 --- ai.memory/MEMORY.md | 1 + ai.memory/project_api_key_rotation.md | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 ai.memory/project_api_key_rotation.md diff --git a/ai.memory/MEMORY.md b/ai.memory/MEMORY.md index ba6012c..c08f175 100644 --- a/ai.memory/MEMORY.md +++ b/ai.memory/MEMORY.md @@ -5,6 +5,7 @@ > 组织方式:本文件是索引(一行一条),各主题内容放在独立文件中。 - [CADProject 图纸审查 Agent 工作](project_dwg_review_agent.md) — 基于 MCP 框架的图纸审查工具集与逐图框审查流程 +- [DeepSeek API Key 泄露与轮换(待办)](project_api_key_rotation.md) — Key 已入 git 历史并推送远程,删文件无效,须去控制台轮换(待用户操作) - [LLM 识图审图 Agent 架构决策](project_review_agent_impl.md) — 混合式自研 agent、基座 B 最小集、标准化先走 stdio 桥;含 dwg_review 包结构 - [stdio↔TCP 桥(MCP 标准化)](project_stdio_bridge.md) — mcp_bridge 包:基座协议缺口、读线程+单工作线程设计、MCP Inspector 验证方法与踩坑 - [MCP 基座 c++_dll 加载与执行的坑](project_mcp_frame_dll_loader.md) — acrxGetApiVersion 有状态不可比对、写库需文档锁、同一 DLL 只加载一次 diff --git a/ai.memory/project_api_key_rotation.md b/ai.memory/project_api_key_rotation.md new file mode 100644 index 0000000..8763a42 --- /dev/null +++ b/ai.memory/project_api_key_rotation.md @@ -0,0 +1,23 @@ +--- +name: DeepSeek API Key 泄露与轮换(待办) +description: 硬编码的 DeepSeek API Key 已进入 git 历史并推送远程,删除文件无法清除,必须去控制台轮换 +type: project +--- + +# DeepSeek API Key 泄露与轮换(待办) + +**事实(2026-10-14)**:DeepSeek API Key 曾被**硬编码**在三个根目录脚本里 +(`agent_loop.py:8`、`countOfCircle.py:8`、`dwg_review_agent.py:38`),随提交 `bdd77af` +进入了 **git 历史并推送到远程 Gitea**(`gjm/cad-agent`)。这三个脚本已于 2026-10-14 删除。 + +**Why**:删除文件**不能**清除 git 历史 —— 该 Key 仍可从远程仓库的 `bdd77af` 提交中 +还原出来,因此**必须视为已泄露**。任何人拿到该提交即可使用这个 Key 消耗配额/产生费用。 + +**How to apply**: +- 该 Key 已按「已泄露」对待:**需由用户去 DeepSeek 控制台轮换(吊销旧 Key + 生成新 Key)**。 + 这是一项**仓库外的人工操作**,AI 无法代劳,需在每轮相关对话里提醒直至确认完成。 +- 新 Key 只经环境变量 `DEEPSEEK_API_KEY` 注入;`dwg_review/config.py` 已实现 + 「环境变量读不到时回退读注册表」,不要在代码里再写死。 +- 如需彻底从 git 历史中抹除(`git filter-repo` / BFG + 强推),属于**破坏性且影响共享远程** + 的操作,**必须单独取得用户明确同意**后才可执行,不要顺手做。 +- 复核方式:`git log --all -S ""` 或 `git show bdd77af` 可确认历史中仍存在。