stripe-android: [BUG] ChallengeResult.RuntimeError has non-parcelable fields

Summary

Our application is sometimes experiencing crashes.

Code to reproduce

In the “com.stripe:stripe-3ds2-android:6.1.3” library there’s a sealed class named ChallengeResult. One of the sub-classes is called RuntimeError and looks like this:

   @Parcelize
    data class RuntimeError(
        val throwable: Throwable,
        override val initialUiType: UiType?,
        override val intentData: IntentData
    ) : ChallengeResult()

The class is meant to be parcelable but Throwable or in the user’s case kotlinx.coroutines.TimeoutCancellationException contains an object that is not Serializable.

public class TimeoutCancellationException internal constructor(
    message: String,
    @JvmField internal val coroutine: Job?
)

I believe the object is Job but in my case it’s obfuscated and I cannot tell what’s what.

Full stack strace

Fatal Exception: java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = kotlinx.coroutines.TimeoutCancellationException)
       at android.os.Parcel.writeSerializable(Parcel.java:1770)
       at com.stripe.android.stripe3ds2.transaction.ChallengeResult$RuntimeError.writeToParcel(ChallengeResult.kt:7)
       at android.os.Parcel.writeParcelable(Parcel.java:1739)
       at android.os.Parcel.writeValue(Parcel.java:1645)
       at android.os.Parcel.writeArrayMapInternal(Parcel.java:785)
       at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1510)
       at android.os.Bundle.writeToParcel(Bundle.java:1181)
       at android.os.Parcel.writeBundle(Parcel.java:825)
       at android.content.Intent.writeToParcel(Intent.java:9704)
       at android.app.IActivityManager$Stub$Proxy.finishActivity(IActivityManager.java:4428)
       at android.app.Activity.finish(Activity.java:5871)
       at android.app.Activity.finish(Activity.java:5889)
       at com.stripe.android.stripe3ds2.views.ChallengeActivity.onCreate$lambda-2(ChallengeActivity.kt:153)
       at com.stripe.android.stripe3ds2.views.ChallengeActivity.$r8$lambda$fl8AggV5vMDzEh_sHuDD6SOlW3o(ChallengeActivity.kt)
       at com.stripe.android.stripe3ds2.views.ChallengeActivity$$InternalSyntheticLambda$0$1cfd3e7e99db44972896882b48fc6ee3642a28c52ba706f4e16eff190f517589$1.onChanged(ChallengeActivity.java:4)
       at androidx.lifecycle.LiveData.considerNotify(LiveData.java:133)
       at androidx.lifecycle.LiveData.dispatchingValue(LiveData.java:151)
       at androidx.lifecycle.LiveData.setValue(LiveData.java:309)
       at androidx.lifecycle.MutableLiveData.setValue(MutableLiveData.java:50)
       at androidx.lifecycle.LiveData$1.run(LiveData.java:93)
       at android.os.Handler.handleCallback(Handler.java:808)
       at android.os.Handler.dispatchMessage(Handler.java:101)
       at android.os.Looper.loop(Looper.java:166)
       at android.app.ActivityThread.main(ActivityThread.java:7529)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)

Caused by java.io.NotSerializableException: wu.w1
       at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1233)
       at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1597)
       at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1558)
       at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1481)
       at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1227)
       at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
       at android.os.Parcel.writeSerializable(Parcel.java:1765)
       at com.stripe.android.stripe3ds2.transaction.ChallengeResult$RuntimeError.writeToParcel(ChallengeResult.kt:7)
       at android.os.Parcel.writeParcelable(Parcel.java:1739)
       at android.os.Parcel.writeValue(Parcel.java:1645)
       at android.os.Parcel.writeArrayMapInternal(Parcel.java:785)
       at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1510)
       at android.os.Bundle.writeToParcel(Bundle.java:1181)
       at android.os.Parcel.writeBundle(Parcel.java:825)
       at android.content.Intent.writeToParcel(Intent.java:9704)
       at android.app.IActivityManager$Stub$Proxy.finishActivity(IActivityManager.java:4428)
       at android.app.Activity.finish(Activity.java:5871)
       at android.app.Activity.finish(Activity.java:5889)
       at com.stripe.android.stripe3ds2.views.ChallengeActivity.onCreate$lambda-2(ChallengeActivity.kt:153)
       at com.stripe.android.stripe3ds2.views.ChallengeActivity.$r8$lambda$fl8AggV5vMDzEh_sHuDD6SOlW3o(ChallengeActivity.kt)
       at com.stripe.android.stripe3ds2.views.ChallengeActivity$$InternalSyntheticLambda$0$1cfd3e7e99db44972896882b48fc6ee3642a28c52ba706f4e16eff190f517589$1.onChanged(ChallengeActivity.java:4)
       at androidx.lifecycle.LiveData.considerNotify(LiveData.java:133)
       at androidx.lifecycle.LiveData.dispatchingValue(LiveData.java:151)
       at androidx.lifecycle.LiveData.setValue(LiveData.java:309)
       at androidx.lifecycle.MutableLiveData.setValue(MutableLiveData.java:50)
       at androidx.lifecycle.LiveData$1.run(LiveData.java:93)
       at android.os.Handler.handleCallback(Handler.java:808)
       at android.os.Handler.dispatchMessage(Handler.java:101)
       at android.os.Looper.loop(Looper.java:166)
       at android.app.ActivityThread.main(ActivityThread.java:7529)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)

Android version

Android 8.0.0

Impacted devices

HUAWEI MediaPad M5 lite

Installation method

Gradle dependency

Dependency Versions

Stripe Version 18.2.0

For kotlin: ./gradlew :dependencies | grep kotlin

For stripe-android: ./gradlew :dependencies | grep com.android.tools.build

For Android Gradle Plugin: ./gradlew :dependencies | grep com.stripe:stripe-android

For Gradle version: ./gradlew -v –>

kotlin: stripe-android: Android Gradle Plugin: Gradle:

SDK classes

Video

Other information

2 seconds after the above crash occurs another class occurs here. I believe this crash is caused by the first crash which clears all the in-memory cached data

Fatal Exception: java.lang.IllegalArgumentException: Invalid Publishable Key: You must use a valid Stripe API key to make a Stripe API request. For more info, see https://stripe.com/docs/keys
       at com.stripe.android.ApiKeyValidator.requireValid(ApiKeyValidator.kt:6)
       at com.stripe.android.networking.ApiRequest$Options.<init>(ApiRequest.kt:79)
       at com.stripe.android.networking.ApiRequest$Options.<init>(ApiRequest.kt:56)
       at com.stripe.android.payments.core.authentication.threeds2.DefaultStripe3ds2ChallengeResultProcessor$process$2.invokeSuspend(Stripe3ds2ChallengeResultProcessor.kt:90)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
       at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 20 (11 by maintainers)

Most upvoted comments

Hey there,

Just an update. We found that this issue was among a group of issues found during an audit of our SDK. I will keep this ticket updated as this issue has been fixed it just needs to be taken in to our payments SDK and released. Thanks for your patience.