本卡屬 FR-187(母卡 CM-3711),第 1 批 B:Agent 回報事件(狀態、日誌、升級進度、主控台稽核)(主系統 repo
compliance-manager-be,10 檔/約 870 行)。只掃不修。工作坊會用.claude/workshop-prompts/dispatch-<本卡號>.md當開場 prompt 直接啟動掃描,小弟不必自己打指令。
用 Claude Code 官方 claude-security plugin 掃「Agent 回報事件(狀態、日誌、升級進度、主控台稽核)」這一塊,找出資安問題,寫成 PM 與新手工程師都看得懂的報告。只找問題、不修問題,修是另外開卡的事。
Agent 透過 POST /agents/events 回報各種事情:自己的狀態、錯誤日誌、升級進度與結果、主控台上有人做了什麼(寫進主系統稽核)。這一棒看主系統收下這些回報時信了多少。
Agent 裝在客戶機器上,要假設它可能被控制。被控的 Agent 如果能改到不該改的欄位、冒用主系統帳號名義寫稽核紀錄、或謊報「升級成功」,主系統的畫面與稽核紀錄就不可信。
背景:這一輪掃的是 2026-11-01(FR-172 開案)到 11-09 之間主專案與 jedi-remote-agent 新寫或大改的程式(FR-171/172/178/179/180/181/182),這些程式都沒掃過。
core/plugins/_agent_events.py
app/remote_agent/service/agent_event_dispatcher.py
api/remote_agent/routes/agent_events_route.py
core/plugins/_agent_status.py
core/plugins/_agent_logs.py
domain/support/service/agent_log_domain_service.py
infra/support/agent_log_repo_impl.py
app/product_update/service/agent_update_event_handlers.py
core/plugins/_agent_console_audit.py
core/plugins/_agent_error_tracking.py
檔數 10、約 870 行。驗檔數:git -C <工作目錄> ls-files -- core/plugins/_agent_events.py app/remote_agent/service/agent_event_dispatcher.py api/remote_agent/routes/agent_events_route.py core/plugins/_agent_status.py core/plugins/_agent_logs.py domain/support/service/agent_log_domain_service.py infra/support/agent_log_repo_impl.py app/product_update/service/agent_update_event_handlers.py core/plugins/_agent_console_audit.py core/plugins/_agent_error_tracking.py | wc -l 應為 10。scope 外的檔不要讀,除非下面「重點看什麼」明寫「只追這幾行」;越界的發現首腦驗收時會挑掉。
首腦讀過程式碼後認為最容易出事的地方,是思考起點不是檢查清單,行號以 2026-11-09 的主線為準,對不上就以內容為準。工具不會照這份走,掃完後你要自己逐條對一遍:工具沒報的,開檔看一眼,寫「人工查過:成立/不成立/為什麼」。
agent_event_dispatcher.py:57-68 身分只認通行證(對);但去重鍵(:91)用 Agent 自報的 at、job_id,換個 at 就能無限重送。事件端點有沒有每台的頻率與大小上限,各 handler 自己的冪等夠不夠。_agent_status.py:44-75 白名單鍵寫回 remote_agents:逐鍵確認沒有能改到狀態、租戶、憑證、enabled 的鍵。browser_port 這類值會進前門 CSP 白名單(看 core/plugins/_agent_origins.py,不在本棒 scope,只追接縫):Agent 自報的埠或位址能不能把任意網址塞進主系統的 CSP。_agent_logs.py+agent_log_domain_service.py:Agent 送的日誌寫進主系統 agent_logs,訊息長度、筆數、等級白名單;這些文字之後會顯示在日誌查詢頁。agent_update_event_handlers.py:188-200 _finish 用 Agent 自報的版本與成敗改更新中心的推送結果:偽造「升級成功」會不會讓更新中心以為整批升完、停止重試。agent_update_event_handlers.py:219-246 save_log:升級紀錄附件的大小上限;檔名已由系統產(:242 註明),clean_job_id 的白名單。_agent_console_audit.py:97-108 把 Agent 自報的 actor 當操作者寫進稽核、還去查真實使用者的暱稱:被控的 Agent 能不能以主系統某個真實帳號的名義寫稽核紀錄。_agent_error_tracking.py:45-60 註冊回應附帶錯誤追蹤設定:送給 Agent 的是不是只有它該拿的那一份。