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

Make Android installation ID filename unique

Open cheng-liven opened this issue 4 years ago • 3 comments

Platform:

  • [x] Android -> If yes, which Device API (and compileSdkVersion/targetSdkVersion/Build tools) version?

The version of the SDK: 5.1.1

Other questions were removed since not relevant


I have the following issue:

https://github.com/getsentry/sentry-java/blob/main/sentry-android-core/src/main/java/io/sentry/android/core/Installation.java#L18

The device ID file Sentry saved used the same filename as our app internal file.

Steps to reproduce:

  • Integrate Sentry SDK in Android app

Actual result:

  • For new app installation, Sentry will save a UUID into this file, which is not a format expected by our internal code.
  • For existing app installation, Sentry would receive a non-UUID value generated by our internal code.

Expected result:

  • Sentry SDK should make the filename unique, e.g. with a SENTRY- prefix

Suggested mitigation path:

if SENTRY-INSTALLATION file exists
    return its content
if INSTALLATION file exists and its content is UUID
    id = INSTALLATION file content (UUID)  // Reuse UUID generated by released Sentry SDK versions
else  // INSTALLATION file not exists or content is not valid UUID
    id = new UUID
save id to SENTRY-INSTALLATION file
return id

(Please do not try to delete the existing INSTALLATION file as it might be generated by other code than sentry SDK)

cheng-liven avatar Aug 20 '21 00:08 cheng-liven