From af5be0bc8fa08e92bad0db1e57b29a36353f241b Mon Sep 17 00:00:00 2001 From: Sean Morley <98704938+seanmorley15@users.noreply.github.com> Date: Thu, 5 Jun 2025 15:10:41 -0400 Subject: [PATCH] Potential fix for code scanning alert no. 21: Information exposure through an exception Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- backend/server/integrations/views.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/server/integrations/views.py b/backend/server/integrations/views.py index 72327f8..f5ba0eb 100644 --- a/backend/server/integrations/views.py +++ b/backend/server/integrations/views.py @@ -12,6 +12,8 @@ from adventures.models import AdventureImage from django.http import HttpResponse from django.shortcuts import get_object_or_404 +logger = logging.getLogger(__name__) + class IntegrationView(viewsets.ViewSet): permission_classes = [IsAuthenticated] def list(self, request): @@ -420,9 +422,11 @@ class ImmichIntegrationViewSet(viewsets.ModelViewSet): except requests.exceptions.SSLError: return False, original_server_url, "SSL certificate error - check server certificate" except requests.exceptions.RequestException as e: - return False, original_server_url, f"Connection failed: {str(e)}" + logger.error(f"RequestException during Immich connection validation: {str(e)}") + return False, original_server_url, "Connection failed due to a network error." except Exception as e: - return False, original_server_url, f"Unexpected error: {str(e)}" + logger.error(f"Unexpected error during Immich connection validation: {str(e)}") + return False, original_server_url, "An unexpected error occurred while validating the connection." # If we get here, none of the endpoints worked return False, original_server_url, "Immich server endpoint not found - check server URL"