π‘οΈ Sentinel: [CRITICAL] Fix path traversal in ApiFilesGet#11
π‘οΈ Sentinel: [CRITICAL] Fix path traversal in ApiFilesGet#11thirdeyenation wants to merge 1 commit intomainfrom
Conversation
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: Path traversal in
api/api_files_get.py. User-provided paths starting with/a0/were resolved directly tofiles.get_abs_path(relative_path)without any subsequent verification. This allowed directory traversal sequences (../) to escape the application's base directory and read arbitrary files on the system.π― Impact: An attacker with API access could read sensitive files on the host (e.g.,
/etc/passwd, ssh keys, environment variables) by passing a carefully crafted relative path.π§ Fix: Added a security validation check using
files.is_in_base_dir(external_path)before attempting to read the resolved file path. This ensures any file returned by the API strictly resides within the allowed base directory.β Verification: Wrote local test scripts to mock the API request and confirmed that traversing to
/etc/passwdcorrectly triggers the security check, returns a warning, and skips reading the file.PR created automatically by Jules for task 8998778357302992232 started by @thirdeyenation