Skip requiresCryptoObject branch for verifyIdentity to prevent crash - #102
Skip requiresCryptoObject branch for verifyIdentity to prevent crash#102AlexBurrowsTBA wants to merge 1 commit into
requiresCryptoObject branch for verifyIdentity to prevent crash#102Conversation
`verifyIdentity()` (with mode="verify") is for identity confirmation and doesn't perform any keystore/crypto operations, but the default configuration sets `requireCryptoObject` to `true`, which causes AuthActivity to create a CryptoObject and pass it to `BiometricPrompt.authenticate()`. This triggers two bugs: 1. When no `allowedBiometryTypes` are specified, the default config sets `promptAuthenticators` to `BIOMETRIC_STRONG | BIOMETRIC_WEAK` with a `CryptoObject` - Android's `BiometricPrompt` requires `BIOMETRIC_STRONG` only when a `CryptoObject` is present, so this throws `IllegalArgumentException` on every device regardless of hardware. 2. Even if the caller works around the first bug by passing `allowedBiometryTypes=[FINGERPRINT]` to force `BIOMETRIC_STRONG` only, the `onAuthenticationSucceeded` callback runs `validateCryptoObject()` which can fail with "Biometric security check failed" despite successful authentication. This commit adds `"verify".equals(mode)` guards in AuthActivity to: - Skip `CryptoObject` creation in the authenticate path - Skip `CryptoObject` validation in the success callback Secure credential modes are unaffected and continue to use the crypto path as before.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
📝 WalkthroughWalkthroughModifies AuthActivity.java's biometric authentication flow in "verify" mode: on successful authentication, "verify" mode now finishes the activity immediately, and the authenticate() call now skips CryptoObject when mode is "verify". ChangesVerify Mode Handling
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Beta npm buildThis PR comes from a fork, so beta publish is disabled for security. If you need a beta package, move the branch into this repository first. |
|
Thanks @AlexBurrowsTBA — recreated this fix in-repo as #103 so we can run Cap-go CI / beta publish. |
|
Closing in favor of in-repo PR #103 (same fix, Cap-go CI green). |
|
Superseded by #103 |
verifyIdentity()(with mode="verify") is for identity confirmation and doesn't perform any keystore/crypto operations, but the default configuration setsrequireCryptoObjecttotrue, which causes AuthActivity to create a CryptoObject and pass it toBiometricPrompt.authenticate().This triggers two bugs:
allowedBiometryTypesare specified, the default config setspromptAuthenticatorstoBIOMETRIC_STRONG | BIOMETRIC_WEAKwith aCryptoObject- Android'sBiometricPromptrequiresBIOMETRIC_STRONGonly when aCryptoObjectis present, so this throwsIllegalArgumentExceptionon every device regardless of hardware.allowedBiometryTypes=[FINGERPRINT]to forceBIOMETRIC_STRONGonly, theonAuthenticationSucceededcallback runsvalidateCryptoObject()which can fail with "Biometric security check failed" despite successful authentication.This commit adds
"verify".equals(mode)guards in AuthActivity to:CryptoObjectcreation in the authenticate pathCryptoObjectvalidation in the success callbackSecure credential modes are unaffected and continue to use the crypto path as before.
Summary by CodeRabbit