Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions pkg/tools/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -1094,9 +1094,15 @@ func (t *ExecTool) guardCommand(command, cwd string) string {
}
}

p, err := filepath.Abs(raw)
if err != nil {
continue
// Resolve the path correctly based on cwd:
// - Absolute paths: use as-is (cleaned)
// - Relative paths: join with cwd to resolve correctly
var p string
if filepath.IsAbs(raw) {
p = filepath.Clean(raw)
} else {
p = filepath.Join(cwdPath, raw)
p = filepath.Clean(p)
}

if safePaths[p] {
Expand Down