Files
Arcrun/.env.example
Leo 20c7610371 refactor: 移除已廢棄的自管加密金鑰機制(credential 全面託管 CF Workers Secrets)
leo 2026-07-20 明令:「已經改用 cf 自己的 secrets,不要再說它了」
「我希望以後再也看不到這個詞再出現」

背景:credential 早已遷移至 CF Workers per-script Secrets + D1 目錄,
舊的自管金鑰(client 端 AES-GCM + KV 密文 + crypto_decrypt)是遷移期遺留。
本次連根移除,含一併作廢的死 SaaS 碼。

移除:
- 舊 KV 密文解密路徑(credential-injector.ts 整檔、dual-read fallback)
  前置驗證:leo21c / youlin 兩帳號 CREDENTIALS_KV 實測 *:cred:* 皆 0 筆
- migrate-to-workers-secrets 搬家端點(回填已完成,無可回填)
- /register 路由與 generateApiKey(HMAC 產 ak_ key 是 SaaS 遺物;
  self-hosted 走 namespace 明碼 D21,已無人使用)
- platform_crypto component(三帳號實測 404 已退役,無 workflow 引用)

保留(附理由):
- crypto_decrypt 保留為永遠回失敗的 stub——現役三個 auth .wasm 仍宣告該
  import,缺項會讓 WASM instantiate 直接失敗。待零件重編後可真正刪除。

順帶修復(原不在範圍,但會實際壞事):
- /auth/callback 有 `if (!key) redirect(server_error)` 閘,未設該 secret 的
  實例會登入直接失敗 → 已移除
- OAuth 兩處把 provider token 寫進舊加密 KV(租戶鍵與實際 api_key 在 rotate
  後必然分歧,已失效)→ 改導向 Workers Secrets,包 try/catch 不影響登入
- acr init Standard 模式呼叫已刪除的 /register → 改引導 OAuth 取 key
- .claude/rules 與 system-dev/docs 是同一規範的兩份鏡像,先前只改 rules
  導致鏡像仍在教舊做法 → 已同步(此類雙檔同步應納入檢查)

新用戶安裝從此零 secret 前置。
測試 187/188(唯一 fail 為 pre-existing,stash 驗證與本次無關);
cypher-executor 與 cli typecheck 全綠。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 01:32:48 +08:00

54 lines
2.9 KiB
Bash
Raw Permalink 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.
# ───────────────────────────────────────────────────────────────────────────
# arcrun self-hosted .env 範本
#
# 用法(AI 操盤手會幫你做):把這個檔複製成 .env,然後照下面說明,
# 一格一格把「=」右邊填上。左邊的名稱(KEY)不要改。
# cp .env.example .env
#
# 這個 .env 只放在你自己電腦/專案,已被 .gitignore 排除,不會上傳。
# ───────────────────────────────────────────────────────────────────────────
# ── ① Cloudflare(最基礎,這兩格沒填,下面什麼都跑不了)────────────────────────
#
# arcrun 跑在「你自己的 Cloudflare」上(免費額度即可,不必綁信用卡)。
# 你要先有一個 Cloudflare 帳號,然後拿兩串東西貼回來:
#
# 1) 帳號代碼(Account ID):
# 登入 https://dash.cloudflare.com → 右側欄就有「Account ID」→ 複製貼到下面。
#
# 2) 金鑰(API Token):
# https://dash.cloudflare.com/profile/api-tokens → Create Custom Token →
# 勾三組權限(缺一不可):
# · Account / Workers Scripts / Edit
# · Account / Workers KV Storage / Edit
# · Account / D1 / Edit ← 必勾!arcrun 用 D1 存 workflow/recipe
# 漏勾會在 acr init 建 D1 時報 Authentication error
# → 建立後複製那串 token 貼到下面。(不需要 R2、不需要綁卡,D1 也在免費額度。)
#
CLOUDFLARE_ACCOUNT_ID=
CLOUDFLARE_API_TOKEN=
# ── ② 身份(自架單人用)──────────────────────────────────────────────────────
#
# NAMESPACE:你的資料分區標籤。隨便取個英數小名即可(例:leo、myteam)。
# 這不是密碼,只是用來分隔你的資料。
#
# credential 不再需要自管加密金鑰:明文由 CF Workers Secrets 託管,
# `acr creds push` 會直接寫進你自己的 worker。)
#
NAMESPACE=
# ── ③ 各服務的 token(要連哪個服務才填哪個;可之後再加)────────────────────────
#
# 連外部服務(Notion、Gmail、Telegram…)的 token 放這裡,給 AI 幫你
# 透過 `acr creds push` 加密上傳(不會明文留在雲端)。要連什麼就加一行。
#
# 例:連 Notion → 去 https://www.notion.com/my-integrations 建一個 integration、
# 拿它的 token(ntn_… 開頭),把你要讀的 database 分享給這個 integration
# 然後填在下面:
#
# NOTION_INTEGRATION_TOKEN=