stratumauth / app

📱 Two-Factor Authentication (2FA) client for Android + Wear OS
https://stratumauth.com
GNU General Public License v3.0
3.14k stars 201 forks source link

Biometric unlock broken #1150

Open technodrome opened 5 months ago

technodrome commented 5 months ago

Describe the bug Biometric unlock on 1.25.1 does not work. On app startup, I always have to log in using password. When I head to settings and try to enable BU there, modal with fingerprint scan pops up and I can scan my finger. Then the pill button briefly shows BU enabled but then immediately switches back to disabled BU state.

To Reproduce Steps to reproduce the behavior:

  1. Open app, enter password (cannot use BU)
  2. Click on Settings, try to enable BU, scan, shows BU enabled for a moment, then switches automatically back to BU disabled

Error Failed to store cipher appears in log:

1718214892.080 10250 12351 12351 E uthenticatorpr: Invalid ID 0x00000000.
1718214893.317 10250 12351 12351 E AUTHPRO : Failed to store cipher
1718214893.317 10250 12351 12351 E AUTHPRO : System.ArgumentNullException: ArgumentNull_Generic Arg_ParamName_Name, s
1718214893.317 10250 12351 12351 E AUTHPRO :    at System.Text.Encoding.GetBytes(String )
1718214893.317 10250 12351 12351 E AUTHPRO :    at System.Text.UTF8Encoding.UTF8EncodingSealed.GetBytes(String )
1718214893.317 10250 12351 12351 E AUTHPRO :    at AuthenticatorPro.Droid.Storage.BiometricStorage.Store(String password, Cipher cipher)
1718214893.317 10250 12351 12351 E AUTHPRO :    at AuthenticatorPro.Droid.Activity.SettingsActivity.<>c__DisplayClass21_0.<EnableBiometrics>b__0(Object _, AuthenticationResult result)

Expected behavior Working BU.

App Version 1.25.1, Android 11, OnePlus 7Pro

Additional context Full log attached. 12_06-19-54-39_102.log

jamie-mh commented 5 months ago

Hi,

Thanks for the detailed report. Can you try clearing and setting the app password before enabling biometric unlock?

Cheers

technodrome commented 5 months ago

After doing that, the app is completely broken. I cannot even start it, it completely crashes with the following SQLite error which repeats upon every app start.

SQLite.SQLiteException: file is not a database
   at SQLite.SQLite3.Prepare2(sqlite3 , String )
   at SQLite.SQLiteCommand.Prepare()
   at SQLite.SQLiteCommand.<ExecuteDeferredQuery>d__121[[SQLite.SQLiteConnection.ColumnInfo, SQLite-net, Version=1.9.172.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
   at System.Collections.Generic.List1[[SQLite.SQLiteConnection.ColumnInfo, SQLite-net, Version=1.9.172.0, Culture=neutral, PublicKeyToken=null]]..ctor(IEnumerable1 )
   at System.Linq.Enumerable.ToList[ColumnInfo](IEnumerable1 )
   at SQLite.SQLiteCommand.ExecuteQuery[ColumnInfo]()
   at SQLite.SQLiteConnection.Query[ColumnInfo](String , Object[] )
   at SQLite.SQLiteConnection.GetTableInfo(String )
   at SQLite.SQLiteConnection.CreateTable(Type , CreateFlags )
   at SQLite.SQLiteConnection.CreateTable[Authenticator](CreateFlags )
   at SQLite.SQLiteAsyncConnection.<>c__DisplayClass36_01[[AuthenticatorPro.Core.Entity.Authenticator, AuthenticatorPro.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<CreateTableAsync>b__0(SQLiteConnectionWithLock conn)
   at SQLite.SQLiteAsyncConnection.<>c__DisplayClass33_01[[SQLite.CreateTableResult, SQLite-net, Version=1.9.172.0, Culture=neutral, PublicKeyToken=null]].<WriteAsync>b__0()
   at System.Threading.Tasks.Task`1[[SQLite.CreateTableResult, SQLite-net, Version=1.9.172.0, Culture=neutral, PublicKeyToken=null]].InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__281_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread , ExecutionContext , ContextCallback , Object )
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread , ExecutionContext , ContextCallback , Object )
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& , Thread )
--- End of stack trace from previous location ---
   at AuthenticatorPro.Droid.Database.MigrateAsync(Boolean firstLaunch)
   at AuthenticatorPro.Droid.Database.OpenAsync(String password, Origin origin)
   at AuthenticatorPro.Droid.Database.OpenAsync(String password, Origin origin)
   at AuthenticatorPro.Droid.Activity.MainActivity.OnResumeAsync()
   at AuthenticatorPro.Droid.Activity.AsyncActivity.OnResume()
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
   at Android.App.SyncConDisplayClass2_0.<Post>bPost>b__0()
   at Java.Lang.Thread.RunnableImplementor.Run()
   at Java.Lang.IRunnableInvoker.n_Run(IntPtr jnienv, IntPtr native__this)
   at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V(_JniMarshal_PP_V callback, IntPtr jnienv, IntPtr klazz)
technodrome commented 5 months ago

Had to uninstall the app, reinstall and restore from backup. Lost all the settings. Upon fresh install, app works without SQLite or biometric unlock issues. Could be caused by version upgrade but it is definitely not user-friendly or smooth experience.

@jamie-mh I'll leave it up to you to close this if you do not want to investigate.

ghost commented 5 months ago

It works for me using 1.25.1.

OS: One UI 6.0, based of Android 14 (Samsung)

theAkito commented 5 months ago

For the sake of helping this issue, I tried it on my Android 11 based custom OS. Works fine.

However, I just installed this app and didn't add any entries yet. Maybe some older update broke something earlier, which becomes only visible in rare scenarios?

At least, the following strongly suggests, this is the case.

Upon fresh install, app works without SQLite or biometric unlock issues.

@jamie-mh

Maybe add a warning to an FAQ or the README, so people are aware of such an issue, when upgrading from older versions? 🙂