-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: introduce UI Improvements and experimental compare feature #24
Conversation
|
||
except Exception as e: | ||
current_app.logger.error(f"Comparison error: {str(e)}") | ||
return jsonify({"error": str(e)}), 500 |
Check warning
Code scanning / CodeQL
Information exposure through an exception Medium
Stack trace information
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 3 months ago
To fix the problem, we need to ensure that detailed exception messages are not returned to the user. Instead, we should log the detailed error message on the server and return a generic error message to the user. This can be achieved by modifying the exception handling code to log the error and return a generic message.
Specifically, we will:
- Modify the exception handling code in the
_compare
method to log the detailed error message. - Return a generic error message to the user instead of the detailed exception message.
-
Copy modified line R130 -
Copy modified line R136
@@ -129,3 +129,3 @@ | ||
current_app.logger.error(f"Comparison error: {str(e)}") | ||
return jsonify({"error": str(e)}), 500 | ||
return jsonify({"error": "An internal error has occurred."}), 500 | ||
finally: | ||
@@ -135,3 +135,3 @@ | ||
current_app.logger.error(f"Comparison request error: {str(e)}") | ||
return jsonify({"error": str(e)}), 500 | ||
return jsonify({"error": "An internal error has occurred."}), 500 | ||
|
|
||
except Exception as e: | ||
current_app.logger.error(f"Comparison request error: {str(e)}") | ||
return jsonify({"error": str(e)}), 500 |
Check warning
Code scanning / CodeQL
Information exposure through an exception Medium
Stack trace information
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 3 months ago
To fix the problem, we need to ensure that detailed exception messages are not exposed to the end user. Instead, we should log the detailed error message on the server and return a generic error message to the user. This can be achieved by modifying the exception handling code to log the error using current_app.logger.error
and returning a generic error message in the JSON response.
-
Copy modified line R136
@@ -135,3 +135,3 @@ | ||
current_app.logger.error(f"Comparison request error: {str(e)}") | ||
return jsonify({"error": str(e)}), 500 | ||
return jsonify({"error": "An internal error has occurred."}), 500 | ||
|
…tion Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
No description provided.