feat(credential-store-migration): T5 寫入路徑改走 Workers Secrets + D1 ref
POST/PUT /credentials 改寫:密文值 PUT 進 CF Workers per-script Secrets (唯寫,D19 不持有內容物),D1 credentials 表只存目錄(不含密文)。 secret_ref = CRED_<NAME>_<sha256(api_key)[:8]>,避免跨租戶撞名。 DELETE/GET /credentials 本次不動(仍走舊 KV,T9 範圍),已誠實標注。 新增 CREDENTIALS_DB D1 binding(與 KBDB base 共用同一顆 arcrun-kbdb, 沿用既有 database_id 注入機制)+ CF_SECRETS_API_TOKEN/CF_ACCOUNT_ID env vars(CF_ACCOUNT_ID 由 deploy.ts 自動注入,同 WORKER_SUBDOMAIN 模式)。 §2.4 選項甲落地:client 不再加密,明文值經 TLS 傳輸,cypher 短暫經手 明文不落地不持金鑰——與舊版 01-tech-stack.md 傳輸格式不同,是本 SDD 對舊格式的刻意取代(§6 Q-b 仍需 leo 明確接受)。 驗證:tsc --noEmit exit 0;vitest 26/27(1 pre-existing 無關失敗)。 端到端:真實部署 leo21c arcrun-cypher-executor,POST/PUT /credentials 成功寫入 Workers Secrets + D1 row(CF API + D1 query 雙重確認), 清理測試資料後 restore wrangler.toml(無帳號專屬 id 殘留 git)。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018D6QoC5waFkcjc2N7csJBB
This commit is contained in:
@@ -39,6 +39,15 @@ id = "25bef01d079148919578894434d58c4d"
|
||||
binding = "SESSIONS_KV"
|
||||
id = "455d0505c7534883a4d4985ab8295857"
|
||||
|
||||
# credential-store-migration T2/T5(D19):credential 目錄表(不含密文)。
|
||||
# 與 KBDB base 共用同一顆 arcrun-kbdb D1(比照 kbdb/wrangler.toml 同一個 database id)。
|
||||
# self-hosted:deploy.ts injectWranglerConfig 對任何 toml 內的 database_id 賦值行一律注入
|
||||
# ctx.d1DatabaseId(既有機制,見 kbdb/wrangler.toml 同款註解),本檔沿用不需額外改 deploy.ts。
|
||||
[[d1_databases]]
|
||||
binding = "CREDENTIALS_DB"
|
||||
database_name = "arcrun-kbdb"
|
||||
database_id = "0c580910-e00b-4f8e-9c57-ac54ea52242f" # 官方 prod D1(arcrun-kbdb);self-hosted 由上述機制注入用戶自己的 id
|
||||
|
||||
# 2026-06-04:移除 WASM_BUCKET R2 binding。R2 wasm 路徑早已 dead(平台零件 = 獨立 Worker,
|
||||
# 不從 R2 動態讀),保留只會誤導且 R2 需綁信用卡,與 open source 零費用核心衝突。
|
||||
# SDD: .agents/specs/component-registry-canon/tasks.md Phase 1.5(registry 已於 2026-05-07 移除,此為 cypher-executor 補清)
|
||||
@@ -107,6 +116,12 @@ ENVIRONMENT = "production"
|
||||
# MULTI_TENANT = "true"
|
||||
# ENCRYPTION_KEY 透過 wrangler secret set 設定
|
||||
|
||||
# credential-store-migration T3(§2.3 寫入路徑需要的 token+account id):
|
||||
# CF_SECRETS_API_TOKEN 是機密,透過 `wrangler secret put CF_SECRETS_API_TOKEN` 設定(不進 toml)。
|
||||
# CF_ACCOUNT_ID 非機密(帳號識別碼,不是憑證),比照 WORKER_SUBDOMAIN 由 deploy.ts 自動注入
|
||||
# (injectWranglerConfig 新增 CF_ACCOUNT_ID 注入,ctx.accountId 是 init/update 早就有的值)。
|
||||
CF_ACCOUNT_ID = ""
|
||||
|
||||
# Component worker subdomain(workers.dev 帳號 subdomain)
|
||||
# cypher-executor fetch component worker 一律走 arcrun-{name}.{WORKER_SUBDOMAIN}.workers.dev
|
||||
# 避開同 zone (*.arcrun.dev) 自循環死鎖,見 arcrun.md P0 #9(2026-05-13)
|
||||
|
||||
Reference in New Issue
Block a user