]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/telemetry: redact python crash dump in telemetry
authorSage Weil <sage@newdream.net>
Sat, 19 Jun 2021 16:56:18 +0000 (12:56 -0400)
committerSage Weil <sage@newdream.net>
Wed, 23 Jun 2021 17:00:49 +0000 (13:00 -0400)
Include the exception value in teh crash dump, but redact it in telemetry.
That way the operator can see it (it's useful info!) but we don't risk
sharing identifying data via telemetry.

Signed-off-by: Sage Weil <sage@newdream.net>
src/mgr/PyModule.cc
src/pybind/mgr/telemetry/module.py

index fc03d68df1fdd16873b456c75a3a6898a23fb217..c554ff1d00aa28f8190f0980f809ebbb4e2cb76a 100644 (file)
@@ -106,8 +106,7 @@ std::string handle_pyerror(
     PyObject *l = get_managed_object(formatted_list, boost::python::tag);
     if (PyList_Check(l)) {
       // skip first line, which is: "Traceback (most recent call last):\n"
-      // omit last line, which contains a runtime value that may be identifying!
-      for (unsigned i = 1; i < PyList_Size(l) - 1; ++i) {
+      for (unsigned i = 1; i < PyList_Size(l); ++i) {
        PyObject *val = PyList_GET_ITEM(l, i);
        std::string s = PyUnicode_AsUTF8(val);
        s.resize(s.size() - 1);  // strip off newline character
index 6f36f87ff26ed12b4cd6874ca882f3eeff315f78..79c29b89811c9a872c839269956660fded40ba56 100644 (file)
@@ -306,7 +306,10 @@ class Module(MgrModule):
             if errno:
                 continue
             c = json.loads(crashinfo)
+
+            # redact hostname
             del c['utsname_hostname']
+
             # entity_name might have more than one '.', beware
             (etype, eid) = c.get('entity_name', '').split('.', 1)
             m = hashlib.sha1()
@@ -315,6 +318,12 @@ class Module(MgrModule):
             m.update(eid.encode('utf-8'))
             m.update(self.salt.encode('utf-8'))
             c['entity_name'] = etype + '.' + m.hexdigest()
+
+            # redact final line of python tracebacks, as the exception
+            # payload may contain identifying information
+            if 'mgr_module' in c:
+                c['backtrace'][-1] = '<redacted>'
+
             crashlist.append(c)
         return crashlist