feat: 新增 update_finding_report 工具,写入漏洞 report 字段

- 新增 agent 写工具 update_finding_report(finding_id + report[Markdown]),
  整段覆盖该漏洞的详细报告;finding_id 传 report_finding 返回的 id
- 绑定 worker / planner / mainagent 三个 agent,经 BuiltinToolSeeds 自动入
  tools 目录(首插不覆盖,旧库升级重启即出现,可在 UI 管理/勾选)
- db.SetFindingReportByNodeID / ExplorationStore.SetFindingReport:按 finding
  节点 id 更新独立 findings 行的 report
- 详情页概览已渲染 report,写入后即可展示

go build / agent / server 测试通过。
This commit is contained in:
Autumn-27 committed 2026-08-18 11:56:43 -04:00
1 parent 8092167ae5
commit c0ac501c4b
4 files changed
+53 -3

No files matched your search

+34 -1
View File
@@ -696,6 +696,39 @@ func (t *ToolSet) addFinding() actool.CoreTool {
})
}
// updateFindingReport sets/overwrites a finding's detailed Markdown report
// (findings.report), addressed by the id report_finding returned.
func (t *ToolSet) updateFindingReport() actool.CoreTool {
return writeTool("update_finding_report",
"为已登记的漏洞补充/更新【详细报告】。report 传 Markdown 全文(建议含:漏洞概述、影响、复现步骤、证据/PoC、修复建议)。finding_id 传 report_finding 返回的那个 id。整段覆盖该漏洞已有的报告。",
obj(map[string]any{
"finding_id": idp("目标漏洞 id(report_finding 返回的 id)"),
"report": str("详细报告全文,Markdown 格式"),
}, "finding_id", "report"),
func(_ context.Context, in json.RawMessage) (actool.Result, error) {
var a struct {
FindingID json.RawMessage `json:"finding_id"`
Report string `json:"report"`
}
_ = json.Unmarshal(in, &a)
nodeID := pid(a.FindingID)
if nodeID <= 0 {
return actool.Errorf("finding_id 无效"), nil
}
if t.ts == nil {
return actool.Errorf("update_finding_report 需要任务上下文(exploration store 未初始化)"), nil
}
n, err := t.ts.SetFindingReport(nodeID, a.Report)
if err != nil {
return actool.Errorf(err.Error()), nil
}
if n == 0 {
return actool.Errorf(fmt.Sprintf("未找到 finding_id=%d 对应的漏洞记录(先用 report_finding 登记)", nodeID)), nil
}
return actool.Text(fmt.Sprintf("finding %d report updated (%d chars)", nodeID, len(a.Report))), nil
})
}
// recordFact writes a general exploration RESULT/conclusion (not a vuln, not a
// new asset) into the EXPLORATION graph, chained to the intent that produced it.
// This is the home for observations and — importantly — negative results
@@ -1250,7 +1283,7 @@ func (t *ToolSet) PlannerTools() []actool.CoreTool {
t.getWorkerOutput(), t.getWorkerTrace(), t.searchAllWorkerTraces(), t.listGoals(), t.addIntent(), t.proveGoal(), t.goalMet(),
t.killWorkTool(), t.steerWorkTool(),
// report_finding:规划态势研判时若自身已确证漏洞,可直接登记(与 worker 同工具)。
t.addFinding(),
t.addFinding(), t.updateFindingReport(),
// list_companies:查看企业列表 + scope + 资产数(拿 company_id / 理解归属范围)。
t.listCompanies(),
// add_task_scope:主动把整根域/整公司/某子域/IP 纳入本任务测试范围(覆盖度分母)。