To fix the problem, we need to ensure that the exception message is not exposed 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 using the logging module to log the exception and returning a user-friendly message.
Modify the exception handling block to log the error message using logging.error().
Return a generic error message to the user instead of the detailed exception message.
Suggested fixes powered by Copilot Autofix. Review carefully before merging.
Fixes https://github.com/se2024-jpg/WolfTrack6.0/security/code-scanning/8
To fix the problem, we need to ensure that the exception message is not exposed 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 using the
logging
module to log the exception and returning a user-friendly message.logging.error()
.Suggested fixes powered by Copilot Autofix. Review carefully before merging.