Summary
ReadFileTool currently has two code paths:
- full reads use
environment.read_file(path) and slice/number lines in Python
- ranged reads build and execute
cat -n '{path}' | sed -n ...
That ranged-read branch shells out on caller-controlled path instead of reusing the normal file-read path.
Problem
Because path is interpolated into a shell command, filenames containing shell metacharacters are interpreted by the shell rather than treated as literal file paths. This also makes ranged reads behave differently from the default ReadFileTool path and introduces an unnecessary shell dependency into a read-oriented tool.
Expected behavior
ReadFileTool should read files through environment.read_file(...) for both full reads and ranged reads, and apply line slicing/numbering in Python.
Proposed fix
Remove the shell-based ranged-read branch and reuse the existing Python file-read logic for all reads.
Validation
I have a PR prepared that:
- removes the shell-based ranged-read path
- adds regression tests showing ranged reads no longer invoke
execute()
- confirms in Linux that a path payload that previously executed a proof command is now treated as a literal filename and does not write a proof file
- passes
pytest tests/unittests/tools
Summary
ReadFileToolcurrently has two code paths:environment.read_file(path)and slice/number lines in Pythoncat -n '{path}' | sed -n ...That ranged-read branch shells out on caller-controlled
pathinstead of reusing the normal file-read path.Problem
Because
pathis interpolated into a shell command, filenames containing shell metacharacters are interpreted by the shell rather than treated as literal file paths. This also makes ranged reads behave differently from the defaultReadFileToolpath and introduces an unnecessary shell dependency into a read-oriented tool.Expected behavior
ReadFileToolshould read files throughenvironment.read_file(...)for both full reads and ranged reads, and apply line slicing/numbering in Python.Proposed fix
Remove the shell-based ranged-read branch and reuse the existing Python file-read logic for all reads.
Validation
I have a PR prepared that:
execute()pytest tests/unittests/tools