fix(agent): soften SSRF guard recovery

Keep private URL access blocked at the tool boundary, but return a clear non-retryable hint so the agent can recover conversationally instead of aborting the turn.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Xubin Ren
2026-05-06 00:43:00 +08:00
committed by Xubin Ren
co-authored by Cursor
parent d97e177981
commit db14685a69
3 changed files with 61 additions and 34 deletions
+1 -1
View File
@@ -321,7 +321,7 @@ class ExecTool(Tool):
from nanobot.security.network import contains_internal_url
if contains_internal_url(cmd):
# SSRF stays fatal in the runner, so keep this marker direct.
# The runner turns this marker into a non-retryable security hint.
return "Error: Command blocked by safety guard (internal/private URL detected)"
if self.restrict_to_workspace: