本卡屬 FR-186(Agent 本體資安掃描第二輪),第 2 批 I1:主控台本機登入、鎖定與 session(Agent repo,9 檔/約 1222 行)。只掃不修。工作坊用
.claude/workshop-prompts/dispatch-<本卡號>.md當開場 prompt 直接啟動掃描。
用 Claude Code 官方 claude-security plugin 掃 Guidant AI Agent(repo evidence-agent)的「主控台本機登入、鎖定與 session」,找出資安問題,寫成 PM 與新手工程師都看得懂的報告。只找問題、不修問題。
FR-177 掃過(舊卡 CM-3513),之後有改動;這次重掃要回答兩件事:上次修的有沒有守住、新改的程式有沒有新洞。 範圍按業務模組垂直切(入口→流程→資料),權限漏洞常在層與層的接縫上。
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/app/local_credentials.py
guidant_agent/identity/domain/lockout.py
guidant_agent/identity/adapters/credential_repo.py
guidant_agent/console/api/local_auth_routes.py
檔數 9、約 1222 行。驗檔數: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/app/local_credentials.py guidant_agent/identity/domain/lockout.py guidant_agent/identity/adapters/credential_repo.py guidant_agent/console/api/local_auth_routes.py | grep -v /tests/ | wc -l 應為 9。scope 外的檔不要當發現報;為核對呼叫端翻範圍外的檔可以,報告標「只為查證」。
首腦標的思考起點,不是檢查清單。掃完後 runner 逐條對一遍:工具沒報的,開檔看一眼寫「人工查過:成立/不成立/為什麼」。FR-177 的人工補查抓到的問題不比工具少。(以下沿用 FR-177 舊卡的重點,行號是舊版、以檔名與函式名為準。)
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-177 25 棒報告在 Agent repo docs/security-scan/FR-177/scan-*.md,已登記的 22 條在主系統 repo docs/features/security-scan-consolidated/README.md §3.1 第 219~240 項(全部已修)。已修而且修法成立的不重報;修法不完整、或同一族換個欄位又出現,才報並註明對應項次。