Repository: getsentry/sentry

Issue:
SDK Crash Detection: Remove debug meta
Remove all debug_meta in the event_stripper. If we find out that the system libraries would be useful, we can readd them, which we can detect based on the `code_file` path, which starts with `/System/Library/` or `/usr/lib/system/`, for system libraries.

https://github.com/getsentry/sentry/blob/95086b406dec79e6bcef45f299a3e92f727da2c0/src/sentry/utils/sdk_crashes/event_stripper.py#L41


Discussion:

Resolving patch:
diff --git a/src/sentry/utils/sdk_crashes/event_stripper.py b/src/sentry/utils/sdk_crashes/event_stripper.py
--- a/src/sentry/utils/sdk_crashes/event_stripper.py
+++ b/src/sentry/utils/sdk_crashes/event_stripper.py
@@ -13,9 +13,6 @@ def __init__(self, explanation: str = "") -> None:
     """Keeps the event data if it is of type str, int, float, bool."""
     SIMPLE_TYPE = auto()
 
-    """Keeps the event data no matter the type."""
-    ALL = auto()
-
     """
     Doesn't keep the event data no matter the type. This can be used to explicitly
     specify that data should be removed with an explanation.
@@ -78,7 +75,6 @@ def with_explanation(self, explanation: str) -> "Allow":
             },
         }
     },
-    "debug_meta": Allow.ALL,
     "contexts": {
         "device": {
             "family": Allow.SIMPLE_TYPE,
@@ -109,11 +105,6 @@ def strip_event_data(
         stripped_frames = _strip_frames(frames, sdk_crash_detector)
         new_event_data["exception"]["values"][0]["stacktrace"]["frames"] = stripped_frames
 
-    debug_meta_images = get_path(new_event_data, "debug_meta", "images")
-    if debug_meta_images is not None:
-        stripped_debug_meta_images = _strip_debug_meta(debug_meta_images, stripped_frames)
-        new_event_data["debug_meta"]["images"] = stripped_debug_meta_images
-
     return new_event_data
 
 
@@ -137,8 +128,6 @@ def _strip_event_data_with_allowlist(
 
             if allowed is Allow.SIMPLE_TYPE and isinstance(data_value, (str, int, float, bool)):
                 stripped_data[data_key] = data_value
-            elif allowed is Allow.ALL:
-                stripped_data[data_key] = data_value
             else:
                 continue
 
@@ -154,15 +143,6 @@ def _strip_event_data_with_allowlist(
     return stripped_data
 
 
-def _strip_debug_meta(
-    debug_meta_images: Sequence[Mapping[str, Any]], frames: Sequence[Mapping[str, Any]]
-) -> Sequence[Mapping[str, Any]]:
-
-    frame_image_addresses = {frame["image_addr"] for frame in frames}
-
-    return [image for image in debug_meta_images if image["image_addr"] in frame_image_addresses]
-
-
 def _strip_frames(
     frames: Sequence[Mapping[str, Any]], sdk_crash_detector: SDKCrashDetector
 ) -> Sequence[Mapping[str, Any]]:


Test patch:
diff --git a/tests/sentry/utils/sdk_crashes/test_event_stripper.py b/tests/sentry/utils/sdk_crashes/test_event_stripper.py
--- a/tests/sentry/utils/sdk_crashes/test_event_stripper.py
+++ b/tests/sentry/utils/sdk_crashes/test_event_stripper.py
@@ -1,5 +1,4 @@
 import abc
-from unittest.mock import Mock
 
 from fixtures.sdk_crash_detection.crash_event import (
     IN_APP_FRAME,
@@ -43,29 +42,12 @@ def test_strip_event_data_keeps_allowed_keys(self):
             "platform",
             "sdk",
             "exception",
-            "debug_meta",
             "contexts",
         }
 
         for key in keys_kept:
             assert stripped_event_data.get(key) is not None, f"key {key} should be kept"
 
-    def test_strip_event_data_without_debug_meta(self):
-        event_data = get_crash_event()
-        debug_meta = dict(get_path(event_data, "debug_meta"))
-        debug_meta.pop("images")
-        event_data["debug_meta"] = debug_meta
-
-        event = self.create_event(
-            data=event_data,
-            project_id=self.project.id,
-        )
-
-        stripped_event_data = strip_event_data(event.data, CocoaSDKCrashDetector())
-
-        debug_meta_images = get_path(stripped_event_data, "debug_meta", "images")
-        assert debug_meta_images is None
-
     def test_strip_event_data_strips_context(self):
         event = self.create_event(
             data=get_crash_event(),
@@ -208,20 +190,6 @@ def test_strip_event_data_keeps_exception_stacktrace(self):
             "platform": "platform",
         }
 
-    def test_strip_event_data_strips_non_referenced_dsyms(self):
-        event = self.create_event(
-            data=get_crash_event(),
-            project_id=self.project.id,
-        )
-
-        stripped_event_data = strip_event_data(event.data, Mock())
-
-        debug_meta_images = get_path(stripped_event_data, "debug_meta", "images")
-
-        image_addresses = set(map(lambda image: image["image_addr"], debug_meta_images))
-        expected_image_addresses = {"0x1a4e8f000", "0x100304000", "0x100260000"}
-        assert image_addresses == expected_image_addresses
-
     def test_strip_frames_sentry_in_app_frame_kept(self):
         frames = get_frames("SentryCrashMonitor_CPPException.cpp", sentry_frame_in_app=True)
         self._execute_strip_frames_test(frames)