fix: 登入資料加密存放(符合平台規範) #27

Merged
walkdoggo.yeh merged 4 commits from fix/session-encryption into main 2026-11-17 05:48:35 +00:00
Owner

安全修正:sessions.json 原本把 refresh token 等登入資料以明文存放。

  • 每一筆登入資料用 AES-256-GCM 加密;金鑰用 HKDF 從執行期密鑰導出(SESSION_SECRET,沒有就用 OIDC client secret),不寫進檔案、程式碼或 Git。
  • 沒有密鑰時不存檔,只放記憶體。
  • 舊的明文檔案:部署後讀一次,立刻改寫成加密版,大家不會被登出。
  • 密鑰換掉時解不開的那筆略過,該使用者重新登入即可。

測試 69 項全過(新增:檔案看不到 token/工號、換密鑰讀不到、舊檔自動改寫、重新部署後仍免重新登入且檔案已加密)。
回退點:tag rollback-pre-session-encryption

🤖 Generated with Claude Code

https://claude.ai/code/session_01VDJVpPiGiWjJP1yVvvGhzQ

安全修正:sessions.json 原本把 refresh token 等登入資料以明文存放。 - 每一筆登入資料用 AES-256-GCM 加密;金鑰用 HKDF 從執行期密鑰導出(SESSION_SECRET,沒有就用 OIDC client secret),不寫進檔案、程式碼或 Git。 - 沒有密鑰時不存檔,只放記憶體。 - 舊的明文檔案:部署後讀一次,立刻改寫成加密版,大家不會被登出。 - 密鑰換掉時解不開的那筆略過,該使用者重新登入即可。 測試 69 項全過(新增:檔案看不到 token/工號、換密鑰讀不到、舊檔自動改寫、重新部署後仍免重新登入且檔案已加密)。 回退點:tag rollback-pre-session-encryption 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01VDJVpPiGiWjJP1yVvvGhzQ
walkdoggo.yeh added 4 commits 2026-11-17 05:47:06 +00:00
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VDJVpPiGiWjJP1yVvvGhzQ
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VDJVpPiGiWjJP1yVvvGhzQ
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VDJVpPiGiWjJP1yVvvGhzQ
test: 重新部署後登入資料是加密的
CI / build (push) Successful in 31s
CI / build (pull_request) Successful in 28s
012a770c5b
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VDJVpPiGiWjJP1yVvvGhzQ
walkdoggo.yeh merged commit 5b668ea947 into main 2026-11-17 05:48:35 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: walkdoggo.yeh/leadboard#27