mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-14 10:17:52 -06:00
Prune all sensitive data before sending it to Sentry
CURA-7245
This commit is contained in:
parent
e52dc56a64
commit
62dfadecdf
3 changed files with 23 additions and 10 deletions
|
@ -32,6 +32,8 @@ from UM.Resources import Resources
|
|||
from cura import ApplicationMetadata
|
||||
|
||||
catalog = i18nCatalog("cura")
|
||||
home_dir = os.path.expanduser("~")
|
||||
|
||||
|
||||
MYPY = False
|
||||
if MYPY:
|
||||
|
@ -83,6 +85,20 @@ class CrashHandler:
|
|||
self.dialog = QDialog()
|
||||
self._createDialog()
|
||||
|
||||
@staticmethod
|
||||
def pruneSensitiveData(obj):
|
||||
if type(obj) is list:
|
||||
return [CrashHandler.pruneSensitiveData(item) for item in obj]
|
||||
if type(obj) is dict:
|
||||
return {k: CrashHandler.pruneSensitiveData(v) for k, v in obj.items()}
|
||||
if type(obj) is str:
|
||||
return obj.replace(home_dir, "<user_home>")
|
||||
return obj
|
||||
|
||||
@staticmethod
|
||||
def sentry_before_send(event, hint):
|
||||
return CrashHandler.pruneSensitiveData(event)
|
||||
|
||||
def _createEarlyCrashDialog(self):
|
||||
dialog = QDialog()
|
||||
dialog.setMinimumWidth(500)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue