Skip to content

🛡️ Sentinel: [HIGH] Prevent path traversal in SPA catch-all route - #2

Merged
jpaquay merged 4 commits into
mainfrom
fix/spa-path-traversal-1273223627130387572
Sep 13, 2026
Merged

jpaquay merged 4 commits into
mainfrom
fix/spa-path-traversal-1273223627130387572

Conversation

@jpaquay

@jpaquay jpaquay commented Sep 13, 2026

Copy link
Copy Markdown
Owner

🚨 Severity: HIGH
💡 Vulnerability: Path Traversal via URL-encoded characters in FastAPI SPA catch-all route (/{full_path:path}).
🎯 Impact: An attacker could read arbitrary files on the host filesystem outside dist/ (e.g. server.py or configuration files) via URL-encoded sequences like /%2e%2e/server.py.
🔧 Fix: Resolved requested paths against DIST_DIR.resolve() and validated using .relative_to(DIST_DIR.resolve()), raising HTTP 403 Access Denied if the target path is outside dist/.
✅ Verification: Added test_server.py with test_serve_spa_path_traversal_blocked which verifies that GET /%2e%2e/server.py yields 403 Forbidden.


PR created automatically by Jules for task 1273223627130387572 started by @jpaquay

Validate that files requested via the SPA fallback route /{full_path:path} stay within DIST_DIR using Path.resolve() and Path.relative_to(). Prevent reading arbitrary server files via URL-encoded path traversal sequences like /%2e%2e/server.py. Add unit test test_server.py to verify path traversal attempts return HTTP 403.

Co-authored-by: jpaquay <17704539+jpaquay@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
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 September 13, 2026 16:09
Validate that files requested via the SPA fallback route /{full_path:path} stay within DIST_DIR using Path.resolve() and Path.relative_to(). Prevent reading arbitrary server files via URL-encoded path traversal sequences like /%2e%2e/server.py. Add unit test test_server.py to verify path traversal attempts return HTTP 403 and clean up unused global declarations in server.py.

Co-authored-by: jpaquay <17704539+jpaquay@users.noreply.github.com>
Validate that files requested via the SPA fallback route /{full_path:path} stay within DIST_DIR using Path.resolve() and Path.relative_to(). Prevent reading arbitrary server files via URL-encoded path traversal sequences like /%2e%2e/server.py. Add unit test test_server.py and requirements.txt to ensure CI installs required dependencies for pytest.

Co-authored-by: jpaquay <17704539+jpaquay@users.noreply.github.com>
Validate that files requested via the SPA fallback route /{full_path:path} stay within DIST_DIR using Path.resolve() and Path.relative_to(). Prevent reading arbitrary server files via URL-encoded path traversal sequences like /%2e%2e/server.py. Add requirements.txt and test_server.py to test API endpoints and path traversal handling across CI environments.

Co-authored-by: jpaquay <17704539+jpaquay@users.noreply.github.com>

@jpaquay jpaquay left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jpaquay
jpaquay merged commit 92cfb96 into main Sep 13, 2026
1 of 4 checks passed
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