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

Expose device identifier

Open lhunath opened this issue 2 years ago • 3 comments

Problem Statement

Sentry uses some internal logic to combine device information into a hash called the deviceAppHash, exposed as app.device in the crash reports.

Unfortunately, there is no way for the developer to access this identifier directly. Effectively, this is a private data point internal to Sentry.

I would like to gain access to this identifier. It is quite useful when we want to direct our developers to the crash logs for a specific user's device. Naively, I was building this link as such:

"See Sentry: https://hubstaff.sentry.io/issues/?query=app.device%3A\(UIDevice.current.identifierForVendor?.uuidString)"

But this doesn't work since Sentry hashes the identifier (alongside potentially some other information).

Ideally Sentry shouldn't manage private data on the user which is hidden from the developer.

Solution Brainstorm

The device identifier is generated in Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_System.m, stored in a private g_systemData, copied into eventContext->System.deviceAppHash, written to the crash report's device_app_hash in Sources/SentryCrash/Recording/SentryCrashReport.c.

Suggest exposing the identifier in SentrySDK or SentryClient.

Are you willing to submit a PR?

No response

lhunath avatar Sep 15 '23 16:09 lhunath

Thanks @lhunath for the suggestions. This may be related to #3278.

Ideally Sentry shouldn't manage private data on the user which is hidden from the developer.

We don't manage private data on the user. The device hash holds no PII, it is just a calculated hash that identifies events coming from the same app+device with no identification at all.

brustolin avatar Sep 18 '23 08:09 brustolin

Thanks @brustolin, I was not referring to PII, I was referring to managing data on the user's device which is kept private/internal and hidden from the developer despite being elementary to the crash report.

lhunath avatar Sep 18 '23 13:09 lhunath

The Id will show up on crash reports in Sentry so making them available programatically for the app developer makes sense to me.

bruno-garcia avatar Sep 26 '23 18:09 bruno-garcia