Skip to content

Android: native events are sent unfiltered when BeforeSend conversion fails #5764

Open

Description

@jamescrosswell

On Android, when options.Native.EnableBeforeSend is on, a Java/NDK event that can't be converted to or from a managed SentryEvent is sent unfiltered.

BeforeSendCallback.Execute wraps the conversion (ToSentryEvent, ToHint, ToJavaSentryEvent) in a catch that logs and does return e;, so the original Java event goes out without the user's BeforeSend having run.

#5610 already made exceptions thrown by the user's callback drop the event (BeforeSendWrapper returns null), so conversion failures are now the only thing that reaches this catch. It should be consistent with that: return null so the Java SDK drops the event and records the client report.

Users who enable EnableBeforeSend usually do it to redact data from native events, so sending the raw event when filtering can't run defeats the purpose.

Reported in #5733.

Activity

  1. linear-code commented on Oct 22, 2026

    @linear-code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions