Skip to content

Commit 7d72058

Browse files
committed
Remove HTML escaping from config environment variables
The /config endpoint no longer applies html.escape to BACKEND_API_URL and AUTH_ENABLED environment variables. This change ensures the values are returned as-is, which is more appropriate for non-HTML config data.
1 parent 23972f8 commit 7d72058

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/frontend/frontend_server.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ async def serve_index():
3737

3838
@app.get("/config")
3939
async def get_config():
40-
backend_url = html.escape(os.getenv("BACKEND_API_URL", "http://localhost:8000"))
41-
auth_enabled = html.escape(os.getenv("AUTH_ENABLED", "false"))
40+
backend_url = os.getenv("BACKEND_API_URL", "http://localhost:8000")
41+
auth_enabled = os.getenv("AUTH_ENABLED", "false")
4242
backend_url = backend_url + "/api"
4343

4444
config = {
@@ -53,11 +53,17 @@ async def serve_app(full_path: str):
5353
# Remediation: normalize and check containment before serving
5454
file_path = os.path.normpath(os.path.join(BUILD_DIR, full_path))
5555
# Block traversal and dotfiles
56-
if not file_path.startswith(BUILD_DIR) or ".." in full_path or "/." in full_path or "\\." in full_path:
56+
if (
57+
not file_path.startswith(BUILD_DIR)
58+
or ".." in full_path
59+
or "/." in full_path
60+
or "\\." in full_path
61+
):
5762
return FileResponse(INDEX_HTML)
5863
if os.path.isfile(file_path):
5964
return FileResponse(file_path)
6065
return FileResponse(INDEX_HTML)
6166

67+
6268
if __name__ == "__main__":
6369
uvicorn.run(app, host="127.0.0.1", port=3000, access_log=False, log_level="info")

0 commit comments

Comments
 (0)