浏览代码

also redact __str__ of ApplicationService used for logging

Michael Telatynski 6 年之前
父节点
当前提交
592c162516
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      synapse/appservice/__init__.py

+ 5 - 1
synapse/appservice/__init__.py

@@ -292,4 +292,8 @@ class ApplicationService(object):
         return self.rate_limited
 
     def __str__(self):
-        return "ApplicationService: %s" % (self.__dict__,)
+        # copy dictionary and redact token fields so they don't get logged
+        dict_copy = self.__dict__.copy()
+        dict_copy["token"] = "<redacted>"
+        dict_copy["hs_token"] = "<redacted>"
+        return "ApplicationService: %s" % (dict_copy,)