Skip to content

Commit b3592a1

Browse files
Potential fix for 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>
1 parent aef6ff1 commit b3592a1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

api/views/aimodel_execution.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
from typing import Any
77

8+
import logging
9+
810
from rest_framework import status
911
from rest_framework.decorators import api_view, permission_classes
1012
from rest_framework.permissions import IsAuthenticated
@@ -82,8 +84,9 @@ def call_aimodel(request: Request, model_id: str) -> Response:
8284
status=status.HTTP_404_NOT_FOUND,
8385
)
8486
except ValueError as e:
87+
logging.warning(f"ValueError during model execution: {e}")
8588
return Response(
86-
{"error": str(e)},
89+
{"error": "Invalid input."},
8790
status=status.HTTP_400_BAD_REQUEST,
8891
)
8992
except Exception as e:

0 commit comments

Comments
 (0)