sentry-java icon indicating copy to clipboard operation
sentry-java copied to clipboard

Deobfuscate class/field names in exception messages

Open OlivierFreyssinet-old opened this issue 5 years ago • 10 comments

I'm getting a lot of exceptions of this kind:

NullPointerException
Attempt to read from field 'java.util.List f.f.c.j.b.a.t.a.b' on a null object reference

The stacktrace is perfectly deobfuscated and thanks Sentry for that, it's really great! However I was wondering if it's possible to detect obfuscated class names inside error messages.

Right now in order to understand what this error is I have to open the mapping.txt file and manually search for what the f.f.c.j.b.a.t.a.b field is, which I have to do every time I open such an issue on Sentry.

I guess automatically detecting and deobfuscating obfuscated class/field names in such error messages is not as straightforward as deobfuscating the strack trace but maybe when a mapping file is detected, there could be a button like "Deobfuscate message based on mapping file" next to the error message, and it would look for matches between the message string and the mapping file ?

That would be a killer feature!

OlivierFreyssinet-old avatar Sep 22 '20 16:09 OlivierFreyssinet-old

Thanks for raising. This came up a few times. We should be prioritizing this eventually.

bruno-garcia avatar Sep 22 '20 17:09 bruno-garcia

@OlivierFreyssinet just a quick question, could you exemplify how you are capturing those messages?

Are you doing something like Sentry.captureMessage(exeption.getMessage())? just to understand what you'd be expecting to be deobfuscated.

Thanks.

marandaneto avatar Sep 25 '20 08:09 marandaneto

Sure, I'm just doing Sentry.captureException(exception)

OlivierFreyssinet-old avatar Sep 25 '20 08:09 OlivierFreyssinet-old

@OlivierFreyssinet could you link us to a Sentry issue like this so we could have a look at the event? thanks Breadcrumbs and messages are not deobfuscated, but when you do Sentry.captureException(exception), the event's title should be inferred from the already deobfuscated classes, if not, it's a bug.

marandaneto avatar Sep 25 '20 09:09 marandaneto

Here's one: https://sentry.io/organizations/blloc/issues/1630576419/?project=1284943&query=is%3Aunresolved

Edit: Actually it seems like this exception is handled by the UncaughtExceptionHandler, not manually with a Sentry.captureException

OlivierFreyssinet-old avatar Sep 25 '20 09:09 OlivierFreyssinet-old

This has been tackled on the product, see this comment https://github.com/getsentry/sentry-java/issues/2406#issuecomment-1381977053. Closing this for now, feel free to reopen/comment if it's still not working for some cases and we'll look into it!

romtsn avatar Mar 16 '23 22:03 romtsn

Nice! Thanks for the follow up

ofreyssinet-ledger avatar Mar 16 '23 23:03 ofreyssinet-ledger

Reopening, since this doesn't work anymore after moving deobfuscation to symbolicator

romtsn avatar Jul 23 '24 18:07 romtsn

Any progress on fixing this again? It's pretty annoying to have to manually deobfuscate issues where an obfuscated class name is in the error message like this:

Image

JustinBis avatar Sep 05 '24 23:09 JustinBis

@JustinBis after some investigation we found that this is likely not a regression introduced by the symbolicator move above, but rather a separate issue/scenario. If you have more context (SDKs and version, maybe a link to the event on sentry.io - you can send that to [email protected] if you prefer) please follow up here.

kahest avatar Sep 17 '24 16:09 kahest

Update: I've merged a PR to sentry to address this, so most of the new incoming events' exception values should get deobfuscated from now on. It still does not cover 100% of the cases since it's based on regexps and it does not deobfuscate method/field names yet, but it should be improve the situation already.

romtsn avatar Sep 25 '25 08:09 romtsn