π‘οΈ Sentinel: [CRITICAL] Fix path traversal in file_info and download_work_dir_file#19
Conversation
β¦work_dir_file Co-authored-by: thirdeyenation <133812267+thirdeyenation@users.noreply.github.com>
|
π Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a π emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
π¨ Severity: CRITICAL
π‘ Vulnerability: The
get_abs_pathfunction returns the absolute path untouched if the input is already absolute. This allowed path traversal to read arbitrary files viaapi/file_info.pyandapi/download_work_dir_file.py(e.g. providing/etc/passwd).π― Impact: Attackers could read arbitrary sensitive files on the system or server.
π§ Fix: Implemented
files.is_in_base_dir(abs_path)boundary checks inapi/file_info.py,api/download_work_dir_file.py, andhelpers/file_browser.pyto prevent access to files outside of the configured base directory.β Verification: Tested against standard inputs and absolute paths. The path traversal attempt now logs a warning and raises an Exception or returns
exists: False, resolving the vulnerability. Runpytest tests/to confirm.PR created automatically by Jules for task 96874249595781153 started by @thirdeyenation