File: internal/permission/config_policy.go
Lines: 182-189
Severity: Critical
Problem
In Auto mode, only tools matching isFileTool() get sandbox checks. Neither file_ops nor batch_replace is in isFileTool() (line 366-372). They fall through to return Allow, nil at line 189 with zero sandbox enforcement. Meanwhile isWriteFileTool() (line 380-386) correctly includes both, but is only used in BypassMode/AutopilotMode (line 131), never in AutoMode.
Trigger Scenario
- Agent in Auto mode calls
file_ops(delete, "/etc/passwd")
isCommandTool("file_ops") → false (line 167)
isFileTool("file_ops") → false (line 182) — file_ops not in list
- Falls through to
return Allow, nil (line 189) — sandbox never checked
- File deleted outside workspace sandbox
Same applies to batch_replace — agent can modify files anywhere on filesystem (e.g., ~/.ssh/authorized_keys) without sandbox enforcement.
Expected vs Actual
- Expected: file_ops and batch_replace get sandbox checks in Auto mode (matching Bypass/Autopilot behavior)
- Actual: Both bypass sandbox entirely in Auto mode — arbitrary file operations outside workspace
Fix
Line 182: change isFileTool(toolName) to isFileTool(toolName) || isWriteFileTool(toolName), or add "file_ops" and "batch_replace" to isFileTool().
File:
internal/permission/config_policy.goLines: 182-189
Severity: Critical
Problem
In Auto mode, only tools matching
isFileTool()get sandbox checks. Neitherfile_opsnorbatch_replaceis inisFileTool()(line 366-372). They fall through toreturn Allow, nilat line 189 with zero sandbox enforcement. MeanwhileisWriteFileTool()(line 380-386) correctly includes both, but is only used in BypassMode/AutopilotMode (line 131), never in AutoMode.Trigger Scenario
file_ops(delete, "/etc/passwd")isCommandTool("file_ops")→ false (line 167)isFileTool("file_ops")→ false (line 182) — file_ops not in listreturn Allow, nil(line 189) — sandbox never checkedSame applies to
batch_replace— agent can modify files anywhere on filesystem (e.g., ~/.ssh/authorized_keys) without sandbox enforcement.Expected vs Actual
Fix
Line 182: change
isFileTool(toolName)toisFileTool(toolName) || isWriteFileTool(toolName), or add "file_ops" and "batch_replace" to isFileTool().