Files
cad-agent/ai.memory/project_api_key_rotation.md
T
gjm f4564d49fc docs(memory): 安全备案结案——旧 Key 已吊销、新 Key 验证可用
用户已在 DeepSeek 控制台吊销旧 Key 并在系统级 DEEPSEEK_API_KEY 设置新 Key;
AI 侧验证:read_env 读到非空 + 一次真实 chat_text 调用成功。
2026-10-14 19:14:44 +08:00

30 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
name: DeepSeek API Key 泄露与轮换(已处理)
description: 旧 Key 曾硬编码并进入 git 历史;2026-10-14 已由用户在控制台吊销并换新 Key,验证可用
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 删除。
**处置(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_API_KEY` 注入;
`dwg_review/config.py` 已实现「环境变量读不到时回退读注册表」(因新设的系统变量
不会传播到已启动进程)。
- 若日后仍要从 git 历史中彻底抹除旧 Key(`git filter-repo` / BFG + 强推),属于
**破坏性且影响共享远程**的操作,**必须单独取得用户明确同意**后才可执行。
- 复核历史残留:`git show bdd77af`(或 `git log --all -S "<旧 key 片段>"`)。