Skip to content
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

Potential fix for code scanning alert no. 53: Information exposure through an exception #2054

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jrtcppv
Copy link
Member

@jrtcppv jrtcppv commented Mar 11, 2025

Potential fix for https://github.com/cvisionai/tator/security/code-scanning/53

To fix the problem, we need to ensure that the detailed exception message is not exposed to the client. Instead, we should log the detailed error message on the server and return a generic error message to the client. This can be achieved by modifying the exception handling block to log the detailed error message and return a generic error message.

  • Modify the exception handling block in the __call__ method of the KeycloakMiddleware class.
  • Log the detailed error message using the logger.warning method.
  • Return a generic error message in the JSON response to the client.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…rough an exception

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant