Skip to content

Commit 178266e

Browse files
Fix code scanning alert no. 41: Information exposure through an exception
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 1dac837 commit 178266e

File tree

1 file changed

+4
-2
lines changed
  • End_to_end_Solutions/AOAISearchDemo/app/data

1 file changed

+4
-2
lines changed

End_to_end_Solutions/AOAISearchDemo/app/data/app.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ def get_user_profile(user_id: str):
205205
else:
206206
return Response(response=json.dumps(user_profile.to_item()), status=200)
207207
except Exception as e:
208-
return Response(response=str(e), status=500)
208+
logger.exception(f"get-user-profile: error: {e}")
209+
return Response(response="An internal server error occurred.", status=500)
209210

210211
@app.route('/user-profiles', methods=['GET'])
211212
def get_all_user_profiles():
@@ -214,7 +215,8 @@ def get_all_user_profiles():
214215
json_user_profiles = [user_profile.to_item() for user_profile in user_profiles]
215216
return Response(response=json.dumps(json_user_profiles), status=200)
216217
except Exception as e:
217-
return Response(response=str(e), status=500)
218+
logger.exception(f"get-all-user-profiles: error: {e}")
219+
return Response(response="An internal server error occurred.", status=500)
218220

219221
@app.route('/user-groups/<group_id>', methods=['POST'])
220222
def create_user_group(group_id: str):

0 commit comments

Comments
 (0)