Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaime van Kessel <nallath@gmail.com>2019-12-13 18:25:58 +0300
committerJaime van Kessel <nallath@gmail.com>2019-12-13 18:25:58 +0300
commit6a36a71c2ccc1479d103c03a25ff8380a45a6eab (patch)
treedcb5638d2d98a97d630e7ba01be9dc6c540acc01 /plugins/SentryLogger
parent93ee1115668c3c60aa23f9e492859ceeb0183408 (diff)
Prune user paths from the sentry logs
Diffstat (limited to 'plugins/SentryLogger')
-rw-r--r--plugins/SentryLogger/SentryLogger.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/SentryLogger/SentryLogger.py b/plugins/SentryLogger/SentryLogger.py
index 9d5bb8a21d..c25c7dc0a4 100644
--- a/plugins/SentryLogger/SentryLogger.py
+++ b/plugins/SentryLogger/SentryLogger.py
@@ -5,7 +5,9 @@ from UM.Logger import LogOutput
from typing import Set
from sentry_sdk import add_breadcrumb
from typing import Optional
+import os
+home_dir = os.path.expanduser("~")
class SentryLogger(LogOutput):
def __init__(self) -> None:
@@ -17,6 +19,7 @@ class SentryLogger(LogOutput):
# \param message String containing message to be logged
def log(self, log_type: str, message: str) -> None:
level = self._translateLogType(log_type)
+ message = self._pruneSensitiveData(message)
if level is None:
if message not in self._show_once:
level = self._translateLogType(log_type[0])
@@ -27,6 +30,12 @@ class SentryLogger(LogOutput):
add_breadcrumb(level=level, message=message)
@staticmethod
+ def _pruneSensitiveData(message):
+ if home_dir in message:
+ message = message.replace(home_dir, "<censored_path>")
+ return message
+
+ @staticmethod
def _translateLogType(log_type: str) -> Optional[str]:
level = None
if log_type == "w":