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

Fix code scanning alert no. 3: Information exposure through an exception #2236

Closed
wants to merge 2 commits into from

Conversation

nijel
Copy link
Member

@nijel nijel commented Oct 22, 2024

Fixes https://github.com/WeblateOrg/website/security/code-scanning/3

To fix the problem, we need to ensure that the detailed error message is not exposed to the end user. Instead, we should log the error message on the server and return a generic error message to the user. This can be achieved by using a logging mechanism to record the error details and modifying the HTTP response to return a generic message.

  1. Import the logging module to log the error details.
  2. Replace the line that returns HttpResponseBadRequest(str(error)) with code that logs the error and returns a generic error message.

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

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@nijel nijel marked this pull request as ready for review October 22, 2024 07:02
@nijel nijel enabled auto-merge (rebase) October 22, 2024 07:02
@nijel nijel closed this Oct 22, 2024
auto-merge was automatically disabled October 22, 2024 07:04

Pull request was closed

@nijel nijel deleted the alert-autofix-3 branch October 22, 2024 07:04
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