mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-04 21:21:54 +02:00
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
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user