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

Events #525

Merged
merged 47 commits into from
Nov 19, 2024
Merged

Events #525

merged 47 commits into from
Nov 19, 2024

Conversation

HariRags
Copy link
Contributor

No description provided.

taruspande and others added 30 commits December 11, 2023 14:31
…n_body in Event model, FIX: retrieve method in events.views to check for VerE permission in the verification_body
…rovided,

FIX : try except error for trying to change request.data in events.views.py
FIX : returning fields in EventSerializer and EventFullSerializer,
ADD : Method to fetch the ids of the verifying bodies using the multiselectfield option
ADD : Check on email verified on backend
@HariRags HariRags merged commit ad37249 into master Nov 19, 2024
1 of 5 checks passed
return Response({"success": "Mail sent successfully"})
except Exception as e:
return Response(
{"error_status": True, "msg": f"Error sending mail: {str(e)}"}

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 2 months ago

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

  1. Import the logging module to enable logging of error messages.
  2. Replace the line that returns the detailed exception message with a line that logs the error and returns a generic error message.
Suggested changeset 1
events/views.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/events/views.py b/events/views.py
--- a/events/views.py
+++ b/events/views.py
@@ -18,2 +18,3 @@
 from locations.helpers import create_unreusable_locations
+import logging
 
@@ -256,4 +257,5 @@
                 except Exception as e:
+                    logging.error(f"Error sending mail: {str(e)}")
                     return Response(
-                        {"error_status": True, "msg": f"Error sending mail: {str(e)}"}
+                        {"error_status": True, "msg": "An internal error has occurred while sending mail."}
                     )
EOF
@@ -18,2 +18,3 @@
from locations.helpers import create_unreusable_locations
import logging

@@ -256,4 +257,5 @@
except Exception as e:
logging.error(f"Error sending mail: {str(e)}")
return Response(
{"error_status": True, "msg": f"Error sending mail: {str(e)}"}
{"error_status": True, "msg": "An internal error has occurred while sending mail."}
)
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
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.

5 participants