From ad82f790c1e25b002682c6f54000caf99070c0e7 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 16 Dec 2024 11:59:50 -0800 Subject: [PATCH] Fix code scanning alert no. 149: Information exposure through an exception Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- backend/open_webui/routers/tasks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/routers/tasks.py b/backend/open_webui/routers/tasks.py index a2a6cdc92d..324f81f443 100644 --- a/backend/open_webui/routers/tasks.py +++ b/backend/open_webui/routers/tasks.py @@ -186,9 +186,10 @@ async def generate_title( try: return await generate_chat_completion(request, form_data=payload, user=user) except Exception as e: + log.error("Exception occurred", exc_info=True) return JSONResponse( status_code=status.HTTP_400_BAD_REQUEST, - content={"detail": str(e)}, + content={"detail": "An internal error has occurred."}, )