Open
Description
file:engineer/engineer.py
Description
In the current implementation of _edit_repo_file()
, no security checks are performed on:
- The file path being modified
- The content being written to the file
This introduces potential security vulnerabilities that could result in:
- Malicious large language model (LLM) output writing to sensitive system files
- Path traversal attacks modifying files outside of the intended directory
- No validation of file extensions or content types
Affected Components
- File path handling in
_find_relevant_files()
— only prepends/tmp/repo/
without proper sanitization - Direct file operations in
_edit_repo_file()
— blindly trusts the changes generated by the LLM
Steps to Reproduce
- Craft a malicious prompt that causes the LLM to generate harmful file modifications
- Observe the system executing these changes without validation
Recommended Fixes
- Implement path sanitization and validation
- Add a whitelist for allowed file extensions
- Validate content against dangerous patterns
- Introduce sandboxing for file operations
Metadata
Metadata
Assignees
Labels
No labels