|
| 1 | +/** Definitions for the insecure local authentication query. */ |
| 2 | + |
| 3 | +import java |
| 4 | + |
| 5 | +/** A base class that is used as a callback for biometric authentication. */ |
| 6 | +private class AuthenticationCallbackClass extends Class { |
| 7 | + AuthenticationCallbackClass() { |
| 8 | + this.hasQualifiedName("android.hardware.fingerprint", |
| 9 | + "FingerprintManager$AuthenticationCallback") |
| 10 | + or |
| 11 | + this.hasQualifiedName("android.hardware.biometrics", "BiometricPrompt$AuthenticationCallback") |
| 12 | + } |
| 13 | +} |
| 14 | + |
| 15 | +/** An implementation of the `onAuthenticationSucceeded` method for an authentication callback. */ |
| 16 | +class AuthenticationSuccessCallback extends Method { |
| 17 | + AuthenticationSuccessCallback() { |
| 18 | + this.getDeclaringType().getASupertype+() instanceof AuthenticationCallbackClass and |
| 19 | + this.hasName("onAuthenticationSucceeded") |
| 20 | + } |
| 21 | + |
| 22 | + /** Gets the parameter containing the `authenticationResult` */ |
| 23 | + Parameter getResultParameter() { result = this.getParameter(0) } |
| 24 | + |
| 25 | + /** Gets a use of the result parameter that's used in a `super` call to the base `AuthenticationCallback` class. */ |
| 26 | + private VarAccess getASuperResultUse() { |
| 27 | + exists(SuperMethodCall sup | |
| 28 | + sup.getEnclosingCallable() = this and |
| 29 | + result = sup.getArgument(0) and |
| 30 | + result = this.getResultParameter().getAnAccess() and |
| 31 | + this.getDeclaringType().getASupertype() instanceof AuthenticationCallbackClass |
| 32 | + ) |
| 33 | + } |
| 34 | + |
| 35 | + /** Gets a use of the result parameter, other than one used in a `super` call. */ |
| 36 | + VarAccess getAResultUse() { |
| 37 | + result = this.getResultParameter().getAnAccess() and |
| 38 | + not result = this.getASuperResultUse() |
| 39 | + } |
| 40 | +} |
0 commit comments