From 238b1254698b863dd7d28bd573f9adf69164b4ca Mon Sep 17 00:00:00 2001 From: Arpit Jain <3242828+arpitjain099@users.noreply.github.com> Date: Sun, 20 Oct 2024 13:56:44 +0900 Subject: [PATCH] Fix code scanning alert no. 30: Information exposure through an exception Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- End_to_end_Solutions/AOAISearchDemo/app/data/app.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/End_to_end_Solutions/AOAISearchDemo/app/data/app.py b/End_to_end_Solutions/AOAISearchDemo/app/data/app.py index d1d8ada..2e91b3d 100644 --- a/End_to_end_Solutions/AOAISearchDemo/app/data/app.py +++ b/End_to_end_Solutions/AOAISearchDemo/app/data/app.py @@ -68,7 +68,7 @@ def create_chat_session(user_id: str, conversation_id: str): return Response(response=str(e), status=409) except Exception as e: logger.exception(f"create-chat-session: error: {e} ", extra=properties) - return Response(response=str(e), status=500) + return Response(response="An internal error has occurred.", status=500) @app.route('/chat-sessions//', methods=['GET']) def get_chat_session(user_id: str, conversation_id: str): @@ -92,7 +92,7 @@ def get_chat_session(user_id: str, conversation_id: str): return Response(response=json.dumps(session.to_item()), status=200) except Exception as e: logger.exception(f"get-chat-session: error: {e} ", extra=properties) - return Response(response=str(e), status=500) + return Response(response="An internal error has occurred.", status=500) @app.route('/check-chat-session//', methods=['GET']) def check_chat_session(user_id: str, conversation_id: str):