Biometric authentication is requested without a CryptoObject, so its success protects no key

tx0/kotlin:biometric-without-crypto-objectstrictwarningsecurity/authn-authzdepth fastsecurity, android, cwe-287

What it finds

A biometric prompt answered without a CryptoObject only reports that a finger or face matched; the app then decides on its own to unlock. On a rooted or instrumented device that decision is one patched branch away, and nothing ties the success to a key. Passing a CryptoObject lets the system unlock a key in the hardware keystore only after the user has authenticated, so the protected data cannot be reached otherwise.

Reported for authenticate(promptInfo) of androidx.biometric.BiometricPrompt with one argument, and for the framework BiometricPrompt.authenticate with three, when the receiver is named as a prompt and the first argument as prompt information (or, for the framework, as a cancellation signal). Files that import neither are left alone.

From the rule's source, biometric_without_crypto.rs.

Example from the rule's tests
import androidx.biometric.BiometricPrompt class Unlock(private val biometricPrompt: BiometricPrompt, private val cipher: Cipher) {    fun unlock(info: BiometricPrompt.PromptInfo) {        biometricPrompt.authenticate(info)tx0 reports: biometric authentication without a CryptoObject unlocks no key        biometricPrompt.authenticate(info, BiometricPrompt.CryptoObject(cipher))        session.authenticate(info)        authenticationPrompt.authenticate(cipher)    }}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/kotlin:biometric-without-crypto-object" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/kotlin:biometric-without-crypto-object] reason="..."

tx0 explain tx0/kotlin:biometric-without-crypto-object shows the same in the terminal. Found a false positive? Report it.