From 5c5ab329d775e430952b9fd9a8a02e2ec86ee6fa Mon Sep 17 00:00:00 2001 From: Rohan Chaturvedi Date: Tue, 3 Dec 2024 15:05:14 +0530 Subject: [PATCH] Fix code scanning alert no. 11: Information exposure through an exception Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- backend/ee/billing/webhooks/stripe.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/ee/billing/webhooks/stripe.py b/backend/ee/billing/webhooks/stripe.py index c22a4e9cd..0e2c8bacc 100644 --- a/backend/ee/billing/webhooks/stripe.py +++ b/backend/ee/billing/webhooks/stripe.py @@ -2,6 +2,7 @@ from django.http import JsonResponse from ee.billing.stripe import map_stripe_plan_to_tier import stripe +import logging from api.models import Organisation from django.conf import settings @@ -105,7 +106,8 @@ def handle_subscription_deleted(event): except Organisation.DoesNotExist: return JsonResponse({"error": "Organisation not found"}, status=404) except Exception as e: - return JsonResponse({"error": str(e)}, status=500) + logging.error("An error occurred: %s", str(e)) + return JsonResponse({"error": "An internal error has occurred"}, status=500) @csrf_exempt