Skip to content

Conversation

@GitTimeraider
Copy link
Owner

Potential fix for https://github.com/GitTimeraider/Directadmin-Emailforwarder/security/code-scanning/8

To fix the problem, we should avoid returning the exception message (str(e)) in the API response. Instead, we should return only a generic error message to the client, while logging the full exception details (including stack trace) on the server for debugging purposes. This can be done by removing the 'details': str(e) line from the JSON response in the exception handler for the delete_forwarder endpoint. No changes to the logging are needed, as the stack trace is already printed to the server logs.

What to change:

  • In app/main.py, in the delete_forwarder function, remove the 'details': str(e) field from the JSON response in the exception handler (lines 236–239).
  • No new imports or methods are needed.

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

…ough an exception

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@GitTimeraider GitTimeraider marked this pull request as ready for review August 5, 2025 10:36
@GitTimeraider GitTimeraider merged commit 5dfe12b into main Aug 5, 2025
4 of 5 checks passed
@GitTimeraider GitTimeraider deleted the alert-autofix-8 branch August 5, 2025 14:32
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.

2 participants