mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-10-31 16:22:49 +00:00
Add extra code to make sure we can't upload a session/user id as an extra by mistake
This commit is contained in:
committed by
Jorge Martin Espinosa
parent
c9b904e606
commit
c864fbac8c
+6
-1
@@ -55,8 +55,13 @@ class SentryAnalyticsProvider(
|
|||||||
|
|
||||||
SentryAndroid.init(context) { options ->
|
SentryAndroid.init(context) { options ->
|
||||||
options.dsn = dsn
|
options.dsn = dsn
|
||||||
options.beforeSend = SentryOptions.BeforeSendCallback { event, _ -> event }
|
|
||||||
options.beforeSendTransaction = SentryOptions.BeforeSendTransactionCallback { transaction, _ ->
|
options.beforeSendTransaction = SentryOptions.BeforeSendTransactionCallback { transaction, _ ->
|
||||||
|
// Ensure we'll never upload any session ids
|
||||||
|
val possibleSessionIds = transaction.extras?.filter { (it.value as? String)?.startsWith("@") == true }.orEmpty()
|
||||||
|
for (invalidExtra in possibleSessionIds) {
|
||||||
|
transaction.extras?.remove(invalidExtra.key)
|
||||||
|
}
|
||||||
|
|
||||||
val sessionId = appNavigationStateService.appNavigationState.value.navigationState.currentSessionId()
|
val sessionId = appNavigationStateService.appNavigationState.value.navigationState.currentSessionId()
|
||||||
if (sessionId != null) {
|
if (sessionId != null) {
|
||||||
// This runs in a separate thread, so although using `runBlocking` is not great, at least it shouldn't freeze the app
|
// This runs in a separate thread, so although using `runBlocking` is not great, at least it shouldn't freeze the app
|
||||||
|
|||||||
Reference in New Issue
Block a user