24 lines
1.5 KiB
Markdown
24 lines
1.5 KiB
Markdown
---
|
||
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 "<key 片段>"` 或 `git show bdd77af` 可确认历史中仍存在。
|