docs(security): add Telegram egress migration plan draft [skip ci]

This commit is contained in:
Your Name
2026-06-18 19:33:41 +08:00
parent 01bce6d815
commit a396f25b8f
11 changed files with 1649 additions and 4 deletions

View File

@@ -52,6 +52,8 @@
同日再新增 `docs/security/TELEGRAM-NOTIFICATION-EGRESS-OWNER-REQUEST-DRAFT.md``docs/security/telegram-notification-egress-owner-request-draft.snapshot.json`,將 11 個 direct egress 檔案轉成人工送件前草稿。固定 `request_draft_count=11`、workflow `6`、ops script `4`、API direct `1``required_owner_field_count=19``preflight_check_count=16``outcome_lane_count=9``forbidden_payload_count=14``blocked_action_count=26`request sent、recipient confirmed、owner response accepted、formatter convergence accepted、Telegram send、Bot API call、workflow / script modification、API sender refactor、secret collection、production write、runtime gate 與 action button 仍全部為 `0 / false`
同日再新增 `docs/security/TELEGRAM-NOTIFICATION-EGRESS-MIGRATION-PLAN-DRAFT.md``docs/security/telegram-notification-egress-migration-plan-draft.snapshot.json`,將 11 份草稿排成三個 no-runtime 遷移波次。固定 `migration_candidate_count=11`、workflow `6`、ops script `4`、API direct `1``proposed_wave_count=3``reviewer_check_count=15``blocked_action_count=21`owner response、migration authorized、workflow / script modification、API sender refactor、Telegram send、Bot API call、secret collection、production write、runtime gate 與 action button 仍全部為 `0 / false`
## 1.2c 2026-06-18 Backup / Restore / Escrow 事故後回讀計畫
已新增 `docs/security/BACKUP-RESTORE-POST-INCIDENT-READBACK-PLAN.md``docs/security/backup-restore-post-incident-readback-plan.snapshot.json`,將 38 個 backup / restore / escrow / retention surface 轉成事故後回讀計畫。固定 `readback_candidate_count=38``write_capable_readback_candidate_count=27``live_evidence_required_readback_candidate_count=38``restore_drill_readback_required_candidate_count=38``offsite_or_escrow_readback_required_candidate_count=20``retention_or_remote_delete_readback_required_candidate_count=17``required_readback_field_count=34``reviewer_check_count=32``outcome_lane_count=11``blocked_action_count=51`,讓 `backup_restore_credential``64%` 推進到 `66%`,高價值配置平均維持 `71%`,需 live evidence 類別仍為 `9`

View File

@@ -91,6 +91,8 @@
同日再新增 `telegram_notification_egress_owner_request_draft_v1`,將 11 個 direct egress 檔案轉成人工送件前 owner request 草稿。固定 `request_draft_count=11``workflow_request_draft_count=6``ops_script_request_draft_count=4``api_direct_request_draft_count=1``required_owner_field_count=19``preflight_check_count=16``outcome_lane_count=9``forbidden_payload_count=14``blocked_action_count=26`。request sent、recipient confirmed、audit event emitted、owner response accepted、formatter convergence accepted、break-glass fallback accepted、Telegram send、Bot API call、workflow / script modification、API sender refactor、secret collection、raw payload storage、production write、runtime gate 仍全部為 `0 / false`
同日再新增 `telegram_notification_egress_migration_plan_draft_v1`,將 11 份 owner request 草稿排成 workflow notification wrapper、ops notification wrapper、API sender gateway 三個遷移波次。固定 `migration_candidate_count=11``workflow_migration_candidate_count=6``ops_script_migration_candidate_count=4``api_direct_migration_candidate_count=1``proposed_wave_count=3``owner_response_required_count=11``maintenance_window_required_count=11``rollback_owner_required_count=11`。owner response、migration authorized、workflow / script modification、API sender refactor、Telegram send、Bot API call、secret collection、raw payload storage、production write、runtime gate 仍全部為 `0 / false`
### 0.3d 2026-06-15 Public / Admin / API runtime config 變更證據驗收
`public_runtime_config_change_evidence_acceptance_v1` 已把公開產品頁、AwoooP 後台、API / CORS、frontend env、Sentry tunnel、webhook / callback 與跨產品 runtime route 轉成 metadata-only 變更證據驗收只讀帳本。固定 `candidates=6``c0=5``c1=1``write_capable=6``source_refs=20``required_evidence_fields=21``reviewer_checks=21``outcome_lanes=8``blocked_actions=32`

View File

@@ -96,6 +96,8 @@
同日再新增 `telegram_notification_egress_owner_request_draft_v1`,把 11 個 direct egress 檔案轉成人工送件前草稿。固定 `request_draft_count=11`、workflow `6`、ops script `4`、API direct `1``required_owner_field_count=19``preflight_check_count=16``outcome_lane_count=9``forbidden_payload_count=14``blocked_action_count=26`。這是 handoff envelope不是 request sent、recipient confirmed、audit event emitted、owner response accepted、formatter convergence accepted、workflow / script modification、API sender refactor、Telegram send、Bot API call、secret collection、production write 或 runtime gate。
同日再新增 `telegram_notification_egress_migration_plan_draft_v1`,把 11 份草稿排成 workflow notification wrapper、ops notification wrapper、API sender gateway 三個 no-runtime 遷移波次。固定 `migration_candidate_count=11`、workflow `6`、ops script `4`、API direct `1``proposed_wave_count=3``owner_response_required_count=11``maintenance_window_required_count=11``rollback_owner_required_count=11``migration_authorized_count=0``runtime_gate_count=0`。這是遷移計畫草稿,不是 workflow / script / API sender 變更,也不是 Telegram send、Bot API call、secret collection 或 production write。
## 0.00aaa 2026-06-15 K8s / ArgoCD GitOps 變更證據驗收
本輪把 K8s / ArgoCD 從 owner response acceptance 推進到 GitOps 變更證據驗收只讀帳本:`k8s_argocd_change_evidence_acceptance_v1` 固定 `candidates=4``c0=3``write_capable=4``required_evidence_fields=18``reviewer_checks=18``outcome_lanes=8``blocked_actions=28`,並讓 `k8s_production_gitops` 只讀治理成熟度 `62% -> 64%`,高價值配置平均只讀成熟度仍維持 `68%`。這是 metadata-only 收件驗收,不是 change evidence received / accepted、runtime approval package、ArgoCD API read、ArgoCD sync、kubectl action、Helm upgrade、NetworkPolicy apply、NodePort change、RBAC change、live cluster read、production write 或 runtime gate。

View File

@@ -0,0 +1,83 @@
# Telegram 通知出口遷移計畫草稿
| 項目 | 內容 |
|------|------|
| 日期 | 2026-06-18 |
| 狀態 | `migration_plan_draft_ready_no_runtime_action` |
| 工具 | `scripts/security/telegram-notification-egress-migration-plan-draft.py` |
| Snapshot | `docs/security/telegram-notification-egress-migration-plan-draft.snapshot.json` |
| Source snapshot | `docs/security/telegram-notification-egress-owner-request-draft.snapshot.json` |
| 模式 | metadata-only不改 workflow、不改 script、不重構 API、不送 Telegram |
| runtime gate | `0` |
## 1. 目的
Telegram 通知出口目前已完成三層只讀治理:
1. Inventory固定 `18` 個 direct Bot API `sendMessage` call site。
2. Owner Request Draft把 direct egress 檔案聚成 `11` 份人工送件前草稿。
3. Migration Plan Draft`11` 份草稿排成三個遷移波次,定義 proposed target、owner response、maintenance window、rollback owner、delivery receipt 與 post-check。
這份文件只提供遷移計畫草稿,不代表可以直接修改 `.gitea/workflows``scripts/ops``apps/api/src/services/channel_hub.py`
## 2. 固定數字
| 指標 | 數值 | 解讀 |
|------|------|------|
| `source_request_draft_count` | `11` | 來源 owner request draft 數 |
| `source_direct_bot_api_call_count` | `18` | 來源 direct Bot API call site |
| `migration_candidate_count` | `11` | 每個 direct egress 檔案一個遷移候選 |
| `workflow_migration_candidate_count` | `6` | Gitea workflow 候選 |
| `ops_script_migration_candidate_count` | `4` | Ops script 候選 |
| `api_direct_migration_candidate_count` | `1` | API sender 候選 |
| `proposed_wave_count` | `3` | 三個建議波次 |
| `plan_field_count` | `17` | 每個 candidate 的計畫欄位 |
| `reviewer_check_count` | `15` | reviewer 必檢規則 |
| `outcome_lane_count` | `9` | 審查結果分流 |
| `blocked_action_count` | `21` | 草稿階段禁止動作 |
所有 owner response、migration authorized、workflow / script modification、API sender refactor、Telegram send、Bot API call、secret collection、raw payload storage、production write、runtime gate、action button 都維持 `0 / false`
## 3. 建議波次
| Wave | Scope | Proposed target | 邊界 |
|------|-------|-----------------|------|
| `wave_1_workflow_notification_wrapper` | 6 個 Gitea workflow 檔案、13 個 direct send | `scripts/ci/notify-awoooi-cicd.sh` 或 AWOOI Alertmanager webhook | 需 owner response、維護窗口、rollback owner、Gitea run / notification receipt post-check不得直接改 workflow |
| `wave_2_ops_notification_wrapper` | 4 個 ops script、4 個 direct send | `scripts/ops/notify-awoooi-ops.sh` 或 AWOOI Alertmanager webhook | 需保留 API 離線情境的 break-glass fallback 決策;不得直接改 host script |
| `wave_3_api_sender_gateway` | `apps/api/src/services/channel_hub.py` 1 個 direct send | TelegramGateway final-exit formatter | 需 API owner review、unit test、delivery receipt / mirror readback不得直接重構 API sender |
## 4. Reviewer checks
Reviewer 必須確認:
- source owner request draft 是目前版本。
- owner response、maintenance window、rollback owner、delivery receipt、post-check、redaction contract 與 no-false-green attestation 都存在。
- workflow change、script change、API sender refactor 都必須和本文件分離,另開 change evidence / runtime approval。
- 不收 secret value、hash、partial token、raw message payload 或未脫敏 log。
- 不把 CD success、route `200`、UI 可見或 Telegram 送達當成 AI 自動化閉環完成。
- runtime gate 維持 `0`,直到有獨立人工批准與 post-check。
## 5. Outcome lanes
| Lane | 說明 |
|------|------|
| `draft_waiting_owner_response` | 尚未收到 owner response |
| `ready_for_workflow_migration_review` | workflow 類 metadata 完整,可進 migration review |
| `ready_for_ops_script_migration_review` | ops script 類 metadata 完整,可進 migration review |
| `ready_for_api_sender_migration_review` | API sender 類 metadata 完整,可進 migration review |
| `request_missing_owner_response` | 缺 owner response |
| `request_missing_maintenance_or_rollback` | 缺維護窗口或 rollback owner |
| `reject_secret_or_raw_payload` | 收到 secret 或 raw payload 時拒收 |
| `reject_false_green_claim` | false-green claim 時拒收 |
| `waiting_runtime_gate` | metadata accepted 後仍等待 runtime gate |
## 6. 禁止動作
此草稿階段禁止改 workflow、改 ops script、重構 API sender、送 Telegram、呼叫 Bot API、dispatch workflow、觸發 CD、production deploy、讀 secret store、收 secret value / hash / partial token、保存 raw payload / 未脫敏 log、改 chat route、改 Bot token、rotate secret、把 CD success / route 200 當 delivery receipt、開 runtime gate 或新增 action button。
## 7. 下一步
1. 等 owner response 補齊 11 個 candidate 的 route、message shape、redaction、receipt、maintenance、rollback 與 post-check。
2. 先做 workflow 類 migration review但實作必須另開 change evidence / runtime approval不在本草稿內執行。
3. Ops script 需先確認 API offline fallback 是否仍保留;若保留,必須有明確 break-glass reason 與 redacted message shape。
4. API sender 需由 `channel_hub.py` owner review 是否改走 TelegramGateway並補 unit test / mirror readback。

View File

@@ -96,6 +96,7 @@ Owner 回覆只能提供 metadata / ref不得包含 Bot token、chat secret
## 7. 下一步
1. 人工確認送件對象與 route owner 後,才可把這 11 份草稿送出;送出本身需另有 audit event不由本 snapshot 代替
2. 收到 owner response 後,先做 intake preflight欄位完整、無 secret value、無 raw payload、無 false-green claim
3. 通過 reviewer 後,才可為每個 surface 建 migration planworkflow / script / API sender 修改仍需獨立維護窗口、rollback owner 與 production post-check。
1. `docs/security/TELEGRAM-NOTIFICATION-EGRESS-MIGRATION-PLAN-DRAFT.md` 已把 11 份草稿排成三個遷移波次migration authorized 仍為 `0`
2. 人工確認送件對象與 route owner 後,才可把這 11 份草稿送出;送出本身需另有 audit event不由本 snapshot 代替
3. 收到 owner response 後,先做 intake preflight欄位完整、無 secret value、無 raw payload、無 false-green claim。
4. 通過 reviewer 後,才可為每個 surface 進實作workflow / script / API sender 修改仍需獨立維護窗口、rollback owner 與 production post-check。

File diff suppressed because it is too large Load Diff