Skip to content

Tracking pull request to merge release-0.4.0 to main#442

Merged
kuanfandevops merged 6 commits intomainfrom
release-0.4.0
Mar 20, 2025
Merged

Tracking pull request to merge release-0.4.0 to main#442
kuanfandevops merged 6 commits intomainfrom
release-0.4.0

Conversation

@kuanfandevops
Copy link
Collaborator

No description provided.

kuanfandevops and others added 3 commits February 6, 2025 13:26
* 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

Stack trace information
flows to this location and may be exposed to an external user.

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

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/django/api/viewsets/upload.py b/django/api/viewsets/upload.py
--- a/django/api/viewsets/upload.py
+++ b/django/api/viewsets/upload.py
@@ -165,2 +165,6 @@
         except Exception as e:
-            return JsonResponse({"success": False, "error": str(e)}, status=500)
\ No newline at end of file
+            # 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)
\ No newline at end of file
EOF
@@ -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.
@kuanfandevops kuanfandevops merged commit 6332fd2 into main Mar 20, 2025
26 of 29 checks passed
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.

4 participants