Security: path traversal in the SPA static fallback route — arbitrary file read as the running user
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 85/100
Research direction
Read src/profiles/server/static.py lines 27-35 to see the unprotected catch-all that builds FileResponse from static_dir / full_path. The fix must add .resolve() and prefix containment, then add a regression test that sends ..%2f paths and expects them to fall through to index.html rather than escape the dist dir. Done means no arbitrary file read and test passes.
Written by the indexing model from the issue text.
Description
Summary
src/profiles/server/static.py:27-35 — the hand-rolled SPA catch-all serves any file at static_dir / full_path after only an is_file() check. There is no .resolve() + prefix containment, and uvicorn/starlette percent-decode request paths, so:
GET /..%2f..%2f..%2fetc%2fpasswd
escapes static_dir and is returned via FileResponse. The /assets mount (static.py:22-24, Starlette StaticFiles) is traversal-protected — only the hand-rolled catch-all is vulnerable. Combined with the unauthenticated CORS posture (see companion issue), any webpage (or, on --server-only, any LAN host) can read arbitrary files readable by the user.
Suggested fix
requested = (static_dir / full_path).resolve()
if requested.is_file() and requested.is_relative_to(static_dir.resolve()):
return FileResponse(requested)
plus a regression test hitting ..%2f paths that must fall through to index.html (404/SPA), not escape the dist dir.
- Dominant language
- Python
- Stars
- 1
- Forks
- 1
- Avg merge
- 4h 46m
- Merged PRs (30d)
- 55
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from falbany/ProFiles
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
falbany/ProFiles#187 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug frontend
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug frontend
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
bug frontend
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
All issues in falbany/ProFiles
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
ip-tools/patzilla#219 · 2 comments ·
Maintainers usually reply within 1 day
-
EPSSClient commits to its SQLite cache once per score: a 100-CVE bulk fetch makes 101 disk flushesOpenpriority:p3 technical-debt
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
jimmy058910/jmo-security-repo#1673 ·
Maintainers usually reply within 1 day
-
enhancement ready
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
integration: frontier_silicon
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
home-assistant/core#193176 · 2 comments ·
Maintainers usually reply within 1 day
-
task create and task update take --body-file and --stdinPossibly taken @JuanBarriosS claimed this today. Opencli enhancement good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
pyrite-wiki/pyrite#1687 · 1 comment ·
Maintainers usually reply within 1 day