From f4564d49fc1936609c86c66e116f56d133f19666 Mon Sep 17 00:00:00 2001 From: LittleGuo Date: Wed, 14 Oct 2026 19:14:44 +0800 Subject: [PATCH] =?UTF-8?q?docs(memory):=20=E5=AE=89=E5=85=A8=E5=A4=87?= =?UTF-8?q?=E6=A1=88=E7=BB=93=E6=A1=88=E2=80=94=E2=80=94=E6=97=A7=20Key=20?= =?UTF-8?q?=E5=B7=B2=E5=90=8A=E9=94=80=E3=80=81=E6=96=B0=20Key=20=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E5=8F=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 用户已在 DeepSeek 控制台吊销旧 Key 并在系统级 DEEPSEEK_API_KEY 设置新 Key; AI 侧验证:read_env 读到非空 + 一次真实 chat_text 调用成功。 --- ai.memory/MEMORY.md | 2 +- ai.memory/project_api_key_rotation.md | 34 ++++++++++++++++----------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/ai.memory/MEMORY.md b/ai.memory/MEMORY.md index c08f175..afade36 100644 --- a/ai.memory/MEMORY.md +++ b/ai.memory/MEMORY.md @@ -5,7 +5,7 @@ > 组织方式:本文件是索引(一行一条),各主题内容放在独立文件中。 - [CADProject 图纸审查 Agent 工作](project_dwg_review_agent.md) — 基于 MCP 框架的图纸审查工具集与逐图框审查流程 -- [DeepSeek API Key 泄露与轮换(待办)](project_api_key_rotation.md) — Key 已入 git 历史并推送远程,删文件无效,须去控制台轮换(待用户操作) +- [DeepSeek API Key 泄露与轮换(已处理)](project_api_key_rotation.md) — 旧 Key 曾入 git 历史;2026-10-14 已吊销并换新 Key,验证可用 - [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 index 8763a42..1ce59c6 100644 --- a/ai.memory/project_api_key_rotation.md +++ b/ai.memory/project_api_key_rotation.md @@ -1,23 +1,29 @@ --- -name: DeepSeek API Key 泄露与轮换(待办) -description: 硬编码的 DeepSeek API Key 已进入 git 历史并推送远程,删除文件无法清除,必须去控制台轮换 +name: DeepSeek API Key 泄露与轮换(已处理) +description: 旧 Key 曾硬编码并进入 git 历史;2026-10-14 已由用户在控制台吊销并换新 Key,验证可用 type: project --- -# DeepSeek API Key 泄露与轮换(待办) +# DeepSeek API Key 泄露与轮换(已处理) -**事实(2026-10-14)**: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 删除。 +进入 **git 历史并推送到远程 Gitea**(`gjm/cad-agent`)。三个脚本已于 2026-10-14 删除。 -**Why**:删除文件**不能**清除 git 历史 —— 该 Key 仍可从远程仓库的 `bdd77af` 提交中 -还原出来,因此**必须视为已泄露**。任何人拿到该提交即可使用这个 Key 消耗配额/产生费用。 +**处置(2026-10-14,用户操作)**:用户已在 DeepSeek 控制台**吊销旧 Key**,并在 +Windows **系统级环境变量** `DEEPSEEK_API_KEY` 中设置新 Key。AI 侧已验证: +`config._read_env("DEEPSEEK_API_KEY")` 读到非空值(35 字符),且一次真实 +`chat_text` 调用成功返回 → 新 Key 可用。 + +**Why(保留此记录的理由)**:旧 Key 仍留在 git 历史(`bdd77af`)里,但**已被吊销**, +残留风险很低;删除文件从来不能清除历史,真正生效的处置是**轮换**而非删除。 **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` 可确认历史中仍存在。 +- 不要再把 Key 写进代码:只经环境变量 `DEEPSEEK_API_KEY` 注入; + `dwg_review/config.py` 已实现「环境变量读不到时回退读注册表」(因新设的系统变量 + 不会传播到已启动进程)。 +- 若日后仍要从 git 历史中彻底抹除旧 Key(`git filter-repo` / BFG + 强推),属于 + **破坏性且影响共享远程**的操作,**必须单独取得用户明确同意**后才可执行。 +- 复核历史残留:`git show bdd77af`(或 `git log --all -S "<旧 key 片段>"`)。