You've already forked agentic-coding-workflow
bugfix
This commit is contained in:
@@ -314,8 +314,13 @@ func resolvedEnvelope(reqID uuid.UUID, status PermissionStatus, chosen string) *
|
||||
}
|
||||
}
|
||||
|
||||
// extractToolName 尝试从 toolCall JSON 中提取工具标识。多个 agent 实现的字段名不同,
|
||||
// 依次尝试 name/toolName/kind/title;都取不到则返回空(保守走人工审批)。
|
||||
// extractToolName 尝试从 toolCall JSON 中提取真实工具标识。
|
||||
//
|
||||
// 安全约束(自动放行依据):只接受真实工具名字段(name / toolName)。绝不回退到
|
||||
// ACP toolCall 的 'kind'(粗粒度枚举 read/edit/execute…)或 'title'(自由文本)——
|
||||
// 二者都由不可信 agent 自行填写,agent 可把一个 execute/shell 调用标成 kind='read'
|
||||
// 或冒用白名单里的 title 来绕过人工审批闸门。取不到真实名时返回空串,使 allowlistHit
|
||||
// 一律不放行(保守走人工审批),同时保留空名默认拒绝的语义。
|
||||
func extractToolName(toolCall json.RawMessage) string {
|
||||
if len(toolCall) == 0 {
|
||||
return ""
|
||||
@@ -324,7 +329,7 @@ func extractToolName(toolCall json.RawMessage) string {
|
||||
if err := json.Unmarshal(toolCall, &m); err != nil {
|
||||
return ""
|
||||
}
|
||||
for _, k := range []string{"name", "toolName", "kind", "title"} {
|
||||
for _, k := range []string{"name", "toolName"} {
|
||||
if v, ok := m[k].(string); ok && v != "" {
|
||||
return v
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user