From 45cfa5ab2a905718bfd21c1fd992076d10bc1a17 Mon Sep 17 00:00:00 2001 From: dj-oyu <68707227+dj-oyu@users.noreply.github.com> Date: Wed, 25 Feb 2026 12:56:56 +0900 Subject: [PATCH] fix(sandbox): allow /dev/null and device files in workspace path guard curl -o /dev/null -w "%{http_code}" is a common pattern for HTTP status checks. The workspace path guard was incorrectly blocking it because /dev/null is an absolute path outside the working directory. Character and block device files pose no workspace-escape risk, so they are now exempt from the outside-working-dir check (same logic as executable binaries). Co-Authored-By: Claude Sonnet 4.6 --- pkg/tools/shell.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/tools/shell.go b/pkg/tools/shell.go index f0a3307c4..1cdf17672 100644 --- a/pkg/tools/shell.go +++ b/pkg/tools/shell.go @@ -777,6 +777,12 @@ func (t *ExecTool) guardCommand(command, cwd string) string { if isExecutable(p) { continue } + // Allow character/block device files (e.g. /dev/null used by + // "curl -o /dev/null"). These are not regular files and pose + // no workspace-escape risk. + if info, statErr := os.Stat(p); statErr == nil && info.Mode()&os.ModeDevice != 0 { + continue + } // Agent CLI slash commands: skip non-existent paths // (e.g., "/review" is a command, not a file). if agentCLI {