Commit Graph

3 Commits

Author SHA1 Message Date
Your Name
803b389f6b security(secrets): 替換 test fixture 真 TG bot token 為假值
Some checks failed
run-migration / migrate (push) Failing after 20s
CD Pipeline / build-and-deploy (push) Successful in 9m10s
## 事件
aider-watch v1 session 把真 production TG bot token(NEMOTRON_BOT_TOKEN)
當成 test fixture 寫入下列 tracked 檔(均已 push Gitea):
- apps/api/tests/test_secret_redactor.py
- docs/superpowers/plans/2026-04-19-aider-watch.md (3 處)
- docs/superpowers/plans/2026-04-20-aider-watch-v2.md

違反 feedback_secrets_leak_incidents_2026-04-18.md L2 零信任(source control 無 secrets)。

## 處置
- 統帥決議:不撤銷 token(接受風險)
- 替換為假值 111222333:A*35(明顯 placeholder,仍符合 redactor 判別格式)
- 減少未來 search engine / fork 的暴露面(但 git history 仍存)

## 驗證
secret_redactor.py 8 個 test 全過,telegram regex 仍能辨識新假值格式。

## P1 backlog
- git history 清理(git filter-repo)需統帥批准 force push
- pre-commit hook 防未來再洩(grep TG token 格式 / detect-secrets)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 04:23:09 +08:00
Your Name
4188df6fcc fix(imports): CI 環境 import path 統一為 src.*(移除 apps.api.src.* PEP 420 假依賴)
Some checks are pending
Type Sync Check / check-type-sync (push) Successful in 2m37s
CD Pipeline / build-and-deploy (push) Has started running
## 根因
`apps.api.src.*` 需倉庫根目錄在 sys.path 才能透過 PEP 420 namespace package
解析(因 apps/ 和 apps/api/ 無 __init__.py)。

- CI rootdir=repo root → 可解析(但脆弱依賴)
- 本地 pytest rootdir=apps/api → 解析失敗 → 整個 src.models.__init__ 炸
- CI 錯誤: `test_secret_redactor.py` 無法 import module

## 修復
src.models.__init__ 的 3 處 `apps.api.src.*` 改 `src.*`
src.models.incident 的 1 處 `apps.api.src.*` 改 `src.*`
tests/test_aider_event_models.py import path 統一
tests/test_secret_redactor.py import path 統一

## 驗證
138 個 pytest test 全過(drift + rule_engine + approval_execution + aider_event + incident + secret_redactor)

所有 test 都用 `from src.*` 風格(codebase 既有慣例,pytest rootdir=apps/api 提供 src/ 作 import root)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 04:13:02 +08:00
Your Name
0db4534133 feat(utils): generic secret_redactor (7 patterns)
Some checks failed
run-migration / migrate (push) Failing after 12s
CD Pipeline / build-and-deploy (push) Failing after 1m36s
2026-04-20 04:04:13 +08:00