Skip to content

[Sync] Merge latest changes from main into route_optimizer#42

Open
L0rd008 wants to merge 45 commits into
route_optimizerfrom
main
Open

[Sync] Merge latest changes from main into route_optimizer#42
L0rd008 wants to merge 45 commits into
route_optimizerfrom
main

Conversation

@L0rd008
Copy link
Copy Markdown
Contributor

@L0rd008 L0rd008 commented May 16, 2025

Merging recent updates from main into route_optimizer to ensure compatibility with:

  • Environment variable fixes
  • Docker setup
  • Updated assignment API paths
  • CI workflow changes

No conflicts expected. Please review and approve.

Ke-vin-S and others added 30 commits May 5, 2025 14:52
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>
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>
Comment thread fleet/views/vehicle.py
)
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

Stack trace information
flows to this location and may be exposed to an external user.

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:

  1. Replace the line that returns {'error': str(e)} with a generic error message like {'error': 'An internal error occurred'}.
  2. Log the exception details (e.g., stack trace) on the server using a logging framework such as Python's built-in logging module.

Suggested changeset 1
fleet/views/vehicle.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/fleet/views/vehicle.py b/fleet/views/vehicle.py
--- a/fleet/views/vehicle.py
+++ b/fleet/views/vehicle.py
@@ -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)
 
EOF
@@ -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)

Copilot is powered by AI and may make mistakes. Always verify output.
Comment thread shipments/views.py
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

Stack trace information
flows to this location and may be exposed to an external user.

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:

  1. Replace the {'error': str(e)} response with a generic error message like {'error': 'An internal error has occurred.'}.
  2. Log the exception details, including the stack trace, using Python's logging module.
Suggested changeset 1
shipments/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/shipments/views.py b/shipments/views.py
--- a/shipments/views.py
+++ b/shipments/views.py
@@ -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)
 
EOF
@@ -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)

Copilot is powered by AI and may make mistakes. Always verify output.
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.

4 participants