diff --git a/crates/goose/src/agents/tool_execution.rs b/crates/goose/src/agents/tool_execution.rs index 14ab3ec1153e..5ffd6eb72bfb 100644 --- a/crates/goose/src/agents/tool_execution.rs +++ b/crates/goose/src/agents/tool_execution.rs @@ -91,7 +91,8 @@ impl Agent { counter.goose.prompt_injection_user_decisions = 1, decision = ?confirmation.permission, finding_id = %finding_id, - "User security decision" + tool_request_id = %request.id, + "Prompt injection detection: user decision on command injection finding" ); } diff --git a/crates/goose/src/security/mod.rs b/crates/goose/src/security/mod.rs index e03268356468..780a0a45c45c 100644 --- a/crates/goose/src/security/mod.rs +++ b/crates/goose/src/security/mod.rs @@ -114,20 +114,25 @@ impl SecurityManager { let above_threshold = analysis_result.confidence > config_threshold; let finding_id = format!("SEC-{}", Uuid::new_v4().simple()); + let tool_call_json = + serde_json::to_string(&tool_call).unwrap_or_else(|_| "{}".to_string()); + tracing::warn!( counter.goose.prompt_injection_finding = 1, + threat_type = "command_injection", above_threshold = above_threshold, tool_name = %tool_call.name, tool_request_id = %tool_request.id, + tool_call_json = %tool_call_json, confidence = analysis_result.confidence, explanation = %sanitized_explanation, finding_id = %finding_id, threshold = config_threshold, "{}", if above_threshold { - "Current tool call flagged as malicious after security analysis (above threshold)" + "Prompt injection detection: Current tool call flagged as malicious after security analysis (above threshold)" } else { - "Security finding below threshold - logged but not blocking execution" + "Prompt injection detection: Security finding below threshold (logged but not blocking execution)" } ); if above_threshold { @@ -155,7 +160,7 @@ impl SecurityManager { tracing::info!( counter.goose.prompt_injection_analysis_performed = 1, security_issues_found = results.len(), - "Security analysis complete" + "Prompt injection detection: Security analysis complete" ); Ok(results) }