Tracking pull request to merge release-0.4.0 to main#442
Merged
kuanfandevops merged 6 commits intomainfrom Mar 20, 2025
Merged
Conversation
* Adding clean dataset download for uploads that don't contain errors * Adding frontend component and making file storage happen on minio to avoid storing excel in memory * Removing unused minio function * Adding generate presigned url function for clean datasets to be downloaded from minio * Fixing casing * Moving dataset key creation to before error checking so it can be returned in the response
| }) | ||
|
|
||
| except Exception as e: | ||
| return JsonResponse({"success": False, "error": str(e)}, status=500) No newline at end of file |
Check warning
Code scanning / CodeQL
Information exposure through an exception Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 12 months ago
To fix the problem, we should avoid exposing the exception message directly to the user. Instead, we can log the detailed exception message on the server and return a generic error message to the user. This approach ensures that sensitive information is not exposed while still allowing developers to debug issues using the server logs.
- Modify the exception handling block to log the exception message and return a generic error message in the JSON response.
- Ensure that the logging mechanism is properly set up to capture the exception details.
Suggested changeset
1
django/api/viewsets/upload.py
| @@ -165,2 +165,6 @@ | ||
| except Exception as e: | ||
| return JsonResponse({"success": False, "error": str(e)}, status=500) | ||
| # Log the exception details | ||
| import logging | ||
| logger = logging.getLogger(__name__) | ||
| logger.error("An error occurred while generating the presigned URL", exc_info=True) | ||
| return JsonResponse({"success": False, "error": "An internal error has occurred."}, status=500) |
Copilot is powered by AI and may make mistakes. Always verify output.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.