Skip to content

πŸ›‘οΈ Sentinel: [CRITICAL] Fix path traversal in ApiFilesGet#11

Open
thirdeyenation wants to merge 1 commit intomainfrom
sentinel/fix-api-files-get-path-traversal-8998778357302992232
Open

πŸ›‘οΈ Sentinel: [CRITICAL] Fix path traversal in ApiFilesGet#11
thirdeyenation wants to merge 1 commit intomainfrom
sentinel/fix-api-files-get-path-traversal-8998778357302992232

Conversation

@thirdeyenation
Copy link
Copy Markdown
Owner

🚨 Severity: CRITICAL
πŸ’‘ Vulnerability: Path traversal in api/api_files_get.py. User-provided paths starting with /a0/ were resolved directly to files.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/passwd correctly triggers the security check, returns a warning, and skips reading the file.


PR created automatically by Jules for task 8998778357302992232 started by @thirdeyenation

Co-authored-by: thirdeyenation <133812267+thirdeyenation@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown

πŸ‘‹ 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant