Skip to content

Conversation

@pkooij
Copy link
Member

@pkooij pkooij commented Nov 15, 2025

What this does

This PR adds the Damiao motorbus and open arms bimanual robot (follower) and leader

@pkooij pkooij self-assigned this Nov 15, 2025
@pkooij pkooij added robots Issues concerning robots HW interfaces teleoperators Everything related to teleoperators labels Nov 15, 2025
ser.close()
return {"status": "success", "message": f"Port {port} is accessible"}
except PermissionError as e:
return {"status": "error", "message": f"Permission denied: {e}"}

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 1 day ago

To address the information exposure, the code should avoid returning raw exception messages to users, especially those containing details from e or stack traces. Instead, a generic error message should be sent to the client, while detailed error logging (optionally including the exception message/stack trace) should occur server-side for diagnostics. The fix should target the exception handling blocks within the test_usb_port endpoint (lines 220-224), replacing exception details in API responses with generic messages, and logging the exceptions using a standard logging library (such as Python's built-in logging module). This change will require importing the logging library at the top of the file and initializing a logger, then updating exception handlers to use the logger instead of exposing details through API responses.


Suggested changeset 1
examples/openarms_web_interface/web_record_server.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/examples/openarms_web_interface/web_record_server.py b/examples/openarms_web_interface/web_record_server.py
--- a/examples/openarms_web_interface/web_record_server.py
+++ b/examples/openarms_web_interface/web_record_server.py
@@ -15,6 +15,7 @@
 from pathlib import Path
 from typing import Optional, Any
 import threading
+import logging
 
 import cv2
 import numpy as np
@@ -217,11 +218,14 @@
         ser.close()
         return {"status": "success", "message": f"Port {port} is accessible"}
     except PermissionError as e:
-        return {"status": "error", "message": f"Permission denied: {e}"}
+        logger.warning(f"[USB Test] PermissionError for port {port}: {e}")
+        return {"status": "error", "message": "Permission denied to access the port."}
     except serial.SerialException as e:
-        return {"status": "error", "message": f"Serial error: {e}"}
+        logger.warning(f"[USB Test] SerialException for port {port}: {e}")
+        return {"status": "error", "message": "Serial communication error."}
     except Exception as e:
-        return {"status": "error", "message": f"Error: {e}"}
+        logger.error(f"[USB Test] Unexpected error for port {port}: {e}", exc_info=True)
+        return {"status": "error", "message": "An unexpected error occurred while testing the port."}
 
 
 @app.get("/api/can/interfaces")
EOF
@@ -15,6 +15,7 @@
from pathlib import Path
from typing import Optional, Any
import threading
import logging

import cv2
import numpy as np
@@ -217,11 +218,14 @@
ser.close()
return {"status": "success", "message": f"Port {port} is accessible"}
except PermissionError as e:
return {"status": "error", "message": f"Permission denied: {e}"}
logger.warning(f"[USB Test] PermissionError for port {port}: {e}")
return {"status": "error", "message": "Permission denied to access the port."}
except serial.SerialException as e:
return {"status": "error", "message": f"Serial error: {e}"}
logger.warning(f"[USB Test] SerialException for port {port}: {e}")
return {"status": "error", "message": "Serial communication error."}
except Exception as e:
return {"status": "error", "message": f"Error: {e}"}
logger.error(f"[USB Test] Unexpected error for port {port}: {e}", exc_info=True)
return {"status": "error", "message": "An unexpected error occurred while testing the port."}


@app.get("/api/can/interfaces")
Copilot is powered by AI and may make mistakes. Always verify output.
except PermissionError as e:
return {"status": "error", "message": f"Permission denied: {e}"}
except serial.SerialException as e:
return {"status": "error", "message": f"Serial error: {e}"}

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.
except serial.SerialException as e:
return {"status": "error", "message": f"Serial error: {e}"}
except Exception as e:
return {"status": "error", "message": f"Error: {e}"}

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 1 day ago

To fix the issue, we should ensure that the /api/usb/test/{port:path} endpoint does not reveal internal exception information to the client. Instead, we should:

  • Log the full exception (optionally with stack trace) server-side.
  • Return only a generic error message in the API response if an unexpected exception occurs.

Specific changes:

  • Modify line 224 to log the exception details (using Python's standard logging module, which will require its import near the top) and return a generic error message (e.g., "An internal error has occurred.") to the client.
  • Add the import for the logging module if it doesn't already exist in the snippet.
  • Optionally, configure logging at the start of the file so logs are properly captured.

All changes are to be made within examples/openarms_web_interface/web_record_server.py, specifically in the definition of the /api/usb/test/{port:path} endpoint and at the top of the file for imports/configuration.

Suggested changeset 1
examples/openarms_web_interface/web_record_server.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/examples/openarms_web_interface/web_record_server.py b/examples/openarms_web_interface/web_record_server.py
--- a/examples/openarms_web_interface/web_record_server.py
+++ b/examples/openarms_web_interface/web_record_server.py
@@ -18,6 +18,7 @@
 
 import cv2
 import numpy as np
+import logging
 from fastapi import FastAPI, HTTPException
 from fastapi.middleware.cors import CORSMiddleware
 from fastapi.responses import StreamingResponse
@@ -221,9 +222,9 @@
     except serial.SerialException as e:
         return {"status": "error", "message": f"Serial error: {e}"}
     except Exception as e:
-        return {"status": "error", "message": f"Error: {e}"}
+        logging.error(f"Unexpected error in test_usb_port({port}):", exc_info=True)
+        return {"status": "error", "message": "An internal error has occurred."}
 
-
 @app.get("/api/can/interfaces")
 async def get_can_interfaces():
     """Get available CAN interfaces."""
EOF
@@ -18,6 +18,7 @@

import cv2
import numpy as np
import logging
from fastapi import FastAPI, HTTPException
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import StreamingResponse
@@ -221,9 +222,9 @@
except serial.SerialException as e:
return {"status": "error", "message": f"Serial error: {e}"}
except Exception as e:
return {"status": "error", "message": f"Error: {e}"}
logging.error(f"Unexpected error in test_usb_port({port}):", exc_info=True)
return {"status": "error", "message": "An internal error has occurred."}


@app.get("/api/can/interfaces")
async def get_can_interfaces():
"""Get available CAN interfaces."""
Copilot is powered by AI and may make mistakes. Always verify output.
CarolinePascal and others added 5 commits November 25, 2025 10:49
Signed-off-by: Caroline Pascal <[email protected]>
Signed-off-by: Caroline Pascal <[email protected]>
Signed-off-by: Caroline Pascal <[email protected]>
* add visualize_dataset call from `lerobot_dataset_viz` in web record server

* add delete button

* fixes

* remove viz

* unused import
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

robots Issues concerning robots HW interfaces teleoperators Everything related to teleoperators

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants