[Sync] Merge latest changes from main into route_optimizer#42
Conversation
so, we can split apps easily with only changing the client
- minimizing distance - capacity constraints - pickup and delivery management - dropping deliveries if solution is infeasible
VRP solver with - minimizing distance - capacity constraints - pickup and delivery management
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
update from main
Feature/assign shipment
… easily identified
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Api/driver operations
Moved assignment endpoints to /api/assignments
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…dockerize # Conflicts: # .github/workflows/tests.yml
Dockerize the service
| ) | ||
| return Response({'status': 'location updated'}, status=200) | ||
| except Exception as e: | ||
| return Response({'error': str(e)}, status=400) |
Check warning
Code scanning / CodeQL
Information exposure through an exception Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 year ago
To fix the issue, we need to ensure that exception details are not exposed to external users. Instead, we should log the exception details on the server and return a generic error message to the client. This approach maintains security while still allowing developers to debug issues using the server logs.
Specifically:
- Replace the line that returns
{'error': str(e)}with a generic error message like{'error': 'An internal error occurred'}. - Log the exception details (e.g., stack trace) on the server using a logging framework such as Python's built-in
loggingmodule.
| @@ -112,3 +112,6 @@ | ||
| except Exception as e: | ||
| return Response({'error': str(e)}, status=400) | ||
| import logging | ||
| logger = logging.getLogger(__name__) | ||
| logger.error("Error updating vehicle location", exc_info=True) | ||
| return Response({'error': 'An internal error occurred'}, status=400) | ||
|
|
| except ValidationError as e: | ||
| return Response({'error': e.message}, status=status.HTTP_400_BAD_REQUEST) | ||
| except Exception as e: | ||
| return Response({'error': str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) |
Check warning
Code scanning / CodeQL
Information exposure through an exception Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 year ago
To fix the issue, we will replace the current behavior of returning the string representation of the exception (str(e)) with a generic error message for the user. The actual exception details, including the stack trace, will be logged on the server for debugging purposes. This approach ensures that sensitive information is not exposed to end users while still allowing developers to diagnose issues.
Specifically:
- Replace the
{'error': str(e)}response with a generic error message like{'error': 'An internal error has occurred.'}. - Log the exception details, including the stack trace, using Python's
loggingmodule.
| @@ -35,3 +35,6 @@ | ||
| except Exception as e: | ||
| return Response({'error': str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) | ||
| import logging | ||
| logger = logging.getLogger(__name__) | ||
| logger.error("An unexpected error occurred.", exc_info=True) | ||
| return Response({'error': 'An internal error has occurred.'}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) | ||
|
|
Merging recent updates from
mainintoroute_optimizerto ensure compatibility with:No conflicts expected. Please review and approve.