[security] read_file/write_file tools have no path sandboxing or validation #676
Labels
No labels
area:chat
area:core
area:llm
area:routes
area:tools
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
refactor
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sleepy/odysseus#676
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Security: read_file/write_file tools have no path sandboxing
Files:
src/tool_execution.pylines 375-416The
read_fileandwrite_filetools in_direct_fallback()accept arbitrary filesystem paths with no restrictions:Issues
/etc/shadow,/proc/self/environ,~/.ssh/id_rsa, or any file on the systemwrite_filecan write to/etc/cron.d/backdoor,~/.bashrc,/etc/passwd, or any arbitrary path../../sequences are not checkedBash tool already runs arbitrary commands
Yes, but bash is a known escape hatch. The file tools should be safer than bash — they're designed for document/code workflows. At minimum, non-admin users should be restricted to a working directory.
Suggested fix
/etc/,/proc/,/sys/,~/.ssh/,~/.gnupg/)Fixed via PR #892 — added validate_file_path() with sandbox dirs, blocked system paths, and TOOL_SANDBOX_DIRS env var. 23 new tests.