Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/frontend/frontend_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,14 @@ async def get_config():

@app.get("/{full_path:path}")
async def serve_app(full_path: str):
# First check if file exists in build directory
file_path = os.path.join(BUILD_DIR, full_path)
if os.path.exists(file_path):
# Remediation: normalize and check containment before serving
file_path = os.path.normpath(os.path.join(BUILD_DIR, full_path))
# Block traversal and dotfiles
if not file_path.startswith(BUILD_DIR) or ".." in full_path or "/." in full_path or "\\." in full_path:
return FileResponse(INDEX_HTML)
if os.path.isfile(file_path):
return FileResponse(file_path)
# Otherwise serve index.html for client-side routing
return FileResponse(INDEX_HTML)


if __name__ == "__main__":
uvicorn.run(app, host="127.0.0.1", port=3000)
Loading
Loading