Explorar el Código

Sanitize printer serial numbers in support bundle logs (Issue #216)

The support bundle states that printer serial numbers are NOT collected,
but they were appearing in debug logs. Added regex to sanitize Bambu Lab
serial numbers (00M/01D/01S/01P/03W prefix + alphanumeric) while keeping
the prefix for debugging context.

Example: [01D00A12345678] -> [01D[SERIAL]]

Closes #216
maziggy hace 3 meses
padre
commit
0b3df17920
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  1. 4 0
      backend/app/api/routes/support.py

+ 4 - 0
backend/app/api/routes/support.py

@@ -410,6 +410,10 @@ def _sanitize_log_content(content: str) -> str:
     # Replace email addresses
     content = re.sub(r"\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b", "[EMAIL]", content)
 
+    # Replace Bambu Lab printer serial numbers (format: 00M/01D/01S/01P/03W + alphanumeric, 12-16 chars total)
+    # These appear in logs as [SERIAL] or in messages
+    content = re.sub(r"\b(0[0-3][A-Z0-9])[A-Z0-9]{9,13}\b", r"\1[SERIAL]", content)
+
     # Replace paths with usernames
     content = re.sub(r"/home/[^/\s]+/", "/home/[user]/", content)
     content = re.sub(r"/Users/[^/\s]+/", "/Users/[user]/", content)