Skip to content

🛡️ Sentinel: [HIGH] Fix path traversal via symbolic links#773

Open
georgi wants to merge 4 commits intomainfrom
sentinel/fix-symlink-traversal-15674737945818819123
Open

🛡️ Sentinel: [HIGH] Fix path traversal via symbolic links#773
georgi wants to merge 4 commits intomainfrom
sentinel/fix-symlink-traversal-15674737945818819123

Conversation

@georgi
Copy link
Contributor

@georgi georgi commented Mar 15, 2026

🚨 Severity: HIGH
💡 Vulnerability: Symbolic Link Traversal (Path Traversal variant). Previously, path validation methods like resolve_workspace_path and ensure_within_root relied on os.path.abspath. This meant that if a malicious user or process created a symlink within the workspace that pointed to a sensitive system directory (e.g., /etc), subsequent access via that symlink would be permitted, effectively bypassing the directory restriction.
🎯 Impact: An attacker could read, download, or write files to unauthorized locations outside the user's intended workspace or root directory by traversing symbolic links.
🔧 Fix: Replaced os.path.abspath with os.path.realpath in src/nodetool/io/path_utils.py, src/nodetool/api/file.py, and src/nodetool/api/workspace.py. realpath fully resolves all symbolic links before the bounds check, guaranteeing the ultimate destination file resides within the permitted directory. Added a corresponding unit test to verify this behaviour.
✅ Verification: Ensure tests pass via pytest tests/common/test_path_utils.py tests/api/test_file_api.py tests/api/test_workspace_api.py.


PR created automatically by Jules for task 15674737945818819123 started by @georgi

Updated path validation functions (`resolve_workspace_path`, `ensure_within_root`) to use `os.path.realpath` instead of `os.path.abspath`. This ensures that malicious symlinks pointing outside the designated workspace or root directories are correctly identified and blocked.

Also added tests to explicitly cover symlink traversal scenarios.

Co-authored-by: georgi <19498+georgi@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 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.

google-labs-jules bot and others added 3 commits March 15, 2026 11:31
Updated path validation functions (`resolve_workspace_path`, `ensure_within_root`) to use `os.path.realpath` instead of `os.path.abspath`. This ensures that malicious symlinks pointing outside the designated workspace or root directories are correctly identified and blocked.

Also fixed CI errors related to abstract methods in serp_providers by implementing `search_raw` in ApifyProvider and DataForSEOProvider.

Also added tests to explicitly cover symlink traversal scenarios.

Co-authored-by: georgi <19498+georgi@users.noreply.github.com>
Updated path validation functions (`resolve_workspace_path`, `ensure_within_root`) to use `os.path.realpath` instead of `os.path.abspath`. This ensures that malicious symlinks pointing outside the designated workspace or root directories are correctly identified and blocked.

Also fixed CI errors related to abstract methods in serp_providers by implementing `search_raw` in ApifyProvider and DataForSEOProvider.

Also added tests to explicitly cover symlink traversal scenarios.

Co-authored-by: georgi <19498+georgi@users.noreply.github.com>
Updated path validation functions (`resolve_workspace_path`, `ensure_within_root`) to use `os.path.realpath` instead of `os.path.abspath`. This ensures that malicious symlinks pointing outside the designated workspace or root directories are correctly identified and blocked.

Also fixed CI errors related to abstract methods in serp_providers by implementing `search_raw` in ApifyProvider and DataForSEOProvider.

Also added tests to explicitly cover symlink traversal scenarios.

Co-authored-by: georgi <19498+georgi@users.noreply.github.com>
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