本卡屬 FR-177(母卡 CM-3507),第 6 棒 A6:主控台本機登入、鎖定與 session(Agent repo,8 檔/約 1119 行)。只掃不修。工作坊會用
.claude/workshop-prompts/dispatch-<本卡號>.md當開場 prompt 直接啟動掃描,小弟不必自己打指令。
用 Claude Code 官方 claude-security plugin 掃 Guidant AI Agent(裝在客戶機器上的那支程式,repo evidence-agent)的「主控台本機登入、鎖定與 session」這一塊,找出資安問題並寫成 PM 與新手工程師都看得懂的報告。只找問題、不修問題,修是另外開卡的事。
客戶 IT 人員怎麼登進 Agent 主控台(8444):本機帳號密碼、登入失敗鎖定、登入後的 session 怎麼發與存(為了重啟不掉登入,session 會落檔)、以及維運用的一次性登入 token。
主控台是 Agent 上唯一有「人」操作的面,拿到它就能看證據檔、改儲存設定、發動更新。session 落檔是 FR-172 新加的(session.py:2),檔案被讀走等於拿到所有已登入的人的身分。
guidant_agent/identity/app/local_login.py
guidant_agent/identity/app/local_auth.py
guidant_agent/identity/app/session.py
guidant_agent/identity/app/session_file.py
guidant_agent/identity/app/credentials.py
guidant_agent/identity/domain/lockout.py
guidant_agent/identity/adapters/credential_repo.py
guidant_agent/console/api/local_auth_routes.py
檔數 8、約 1119 行。驗檔數:cd <工作目錄> && git ls-files -- guidant_agent/identity/app/local_login.py guidant_agent/identity/app/local_auth.py guidant_agent/identity/app/session.py guidant_agent/identity/app/session_file.py guidant_agent/identity/app/credentials.py guidant_agent/identity/domain/lockout.py guidant_agent/identity/adapters/credential_repo.py guidant_agent/console/api/local_auth_routes.py | grep '\.py$' | wc -l 應為 8。scope 外的檔不要讀(研究員會越界,越界的發現首腦驗收時會挑掉)。
首腦讀過程式碼後認為最容易出事的地方,是思考起點不是檢查清單。工具不會照這份走,掃完後 runner 要自己逐條對一遍:工具沒報的,開檔看一眼寫「人工查過:成立/不成立/為什麼」。前幾輪最嚴重的發現(FR-076 L2 的 HIGH)都是 runner 照這清單追出來的,不是工具報的。
local_login.py:83-97 一次性 token:secrets.token_urlsafe(32) 夠強,但 :44 存的是 sha256、:68 過期靠檔案裡的 expires_at——token 檔目錄 :58 0700 由誰擁有;:119-125 claim 用 rename 搶,兩個行程同時 claim 會不會都成功。:153 回傳 IP 給 CLI 顯示時排除 127 的邏輯有沒有被拿去做授權判斷。lockout.py:鎖定計數的 key 是帳號還是來源 IP;鎖定狀態存哪(記憶體重啟就清?);鎖定視窗內成功登入會不會重設計數、失敗訊息會不會洩漏帳號存不存在。session.py:87 SESSION_TTL_SEC 多長、有沒有滑動延長;:45 序列化進檔案的欄位有 tenant_id、scope——從檔案載回來時 :56 _PERSISTED 之外的欄位會不會被信任;載回來有沒有重新驗 expires_at。session_file.py:51 載入前檢查 0600+owner+regular file,:109 用 O_NOFOLLOW 寫——寫入是先寫 tmp 再 rename 嗎;多個 worker 同時寫會不會互相覆蓋掉對方的 session(可用性)。cookie 屬性(Secure/HttpOnly/SameSite)在 local_auth_routes.py 哪裡設。credentials.py+credential_repo.py:密碼雜湊用 jedi-password 的哪個演算法、參數;改密碼要不要舊密碼;第一次裝好的預設帳號密碼從哪來、有沒有強制改。local_auth_routes.py:登入端點有沒有速率限制(lockout 之外);登出有沒有真的讓 session 失效(記憶體與檔案都刪);require_session 的 scope 判定在哪、CONSOLE_SCOPES 怎麼對應路由。FR-166 做主控台時決策者踩過「AD 分頁做成填系統帳號」(memory),本棒只看本機帳號這條。本範圍從未掃過。