PhilippC / PhilippC/keepass2android

[BUG] AutoOpen with keyfile dosn't work

Open
#2,406 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
6.2k
Forks
478
Avg merge
1h 4m
Merged PRs (30d)
2

Description

Checks
  • I have read the FAQ section, searched the open issues, and still think this is a new bug.
Describe the bug you encountered:

If a child database is protected with a password and a key file, the child database will not be unlocked automatically. But if only a password is used, it works.

  1. Reset Keepass2Android (by Android).
  2. Create a parent database and activate debugging.
  3. create a child database (with password and keyfile) and add it to the parent database.
  4. Close all databases (parent and child).
  5. Open the parent database.
  6. The child database won't open.

In the debugging log I can find an exception (keepass2android.log):

18.08.2023 16:46:09:861 -- error opening file: System.Net.WebException: An exception occurred during a WebClient request. ---> System.NotSupportedException: The URI prefix is not recognized.
  at System.Net.WebRequest.Create (System.Uri requestUri, System.Boolean useUriBase) [0x000ae] in <6b1cf0be3bd54c56ac3706bf9fe33b14>:0
  at System.Net.WebRequest.Create (System.Uri requestUri) [0x00014] in <6b1cf0be3bd54c56ac3706bf9fe33b14>:0
  at System.Net.WebClient.GetWebRequest (System.Uri address) [0x00000] in <6b1cf0be3bd54c56ac3706bf9fe33b14>:0
  at KeePassLib.Serialization.IOWebClient.GetWebRequest (System.Uri address) [0x00000] in <c8f2f770be014446a2dc46e399d377f0>:0
  at System.Net.WebClient.OpenRead (System.Uri address) [0x0001c] in <6b1cf0be3bd54c56ac3706bf9fe33b14>:0
   --- End of inner exception stack trace ---
  at System.Net.WebClient.OpenRead (System.Uri address) [0x00089] in <6b1cf0be3bd54c56ac3706bf9fe33b14>:0
  at (wrapper remoting-invoke-with-check) System.Net.WebClient.OpenRead(System.Uri)
  at KeePassLib.Serialization.IOConnection.OpenRead (KeePassLib.Serialization.IOConnectionInfo ioc) [0x00094] in <c8f2f770be014446a2dc46e399d377f0>:0
  at KeePassLib.Serialization.IOConnection.ReadFile (KeePassLib.Serialization.IOConnectionInfo ioc) [0x00004] in <c8f2f770be014446a2dc46e399d377f0>:0
18.08.2023 16:46:09:864 -- Java.IO.FileNotFoundException: Exception of type 'Java.IO.FileNotFoundException' was thrown.
  at KeePassLib.Keys.KcpKeyFile.Construct (System.Byte[] pbFileData, KeePassLib.Serialization.IOConnectionInfo iocKeyFile, System.Boolean bThrowIfDbFile) [0x00008] in <c8f2f770be014446a2dc46e399d377f0>:0
  at KeePassLib.Keys.KcpKeyFile.Construct (KeePassLib.Serialization.IOConnectionInfo iocFile, System.Boolean bThrowIfDbFile) [0x00007] in <c8f2f770be014446a2dc46e399d377f0>:0
  at KeePassLib.Keys.KcpKeyFile..ctor (System.String strKeyFile) [0x0000d] in <c8f2f770be014446a2dc46e399d377f0>:0
  at keepass2android.KeeAutoExecExt.AutoOpenEntry (Android.App.Activity activity, keepass2android.AutoExecItem item, System.Boolean bManual, keepass2android.ActivityLaunchMode launchMode) [0x00115] in <fb40c821fb5144dda464d1c7539af8a0>:0
  at keepass2android.SelectCurrentDbActivity.OpenAutoExecEntries (keepass2android.Database db) [0x0006e] in <fb40c821fb5144dda464d1c7539af8a0>:0
  --- End of managed Java.IO.FileNotFoundException stack trace ---
java.io.FileNotFoundException
	at crc64dd09b2a2e58bb27d.SelectCurrentDbActivity.n_onActivityResult(Native Method)
	at crc64dd09b2a2e58bb27d.SelectCurrentDbActivity.onActivityResult(SelectCurrentDbActivity.java:120)
	at android.app.Activity.dispatchActivityResult(Activity.java:8951)
	at android.app.ActivityThread.deliverResults(ActivityThread.java:5987)
	at android.app.ActivityThread.handleSendResult(ActivityThread.java:6033)
	at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:67)
	at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2574)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loopOnce(Looper.java:226)
	at android.os.Looper.loop(Looper.java:313)
	at android.app.ActivityThread.main(ActivityThread.java:8757)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Describe what you expected to happen:

At step 6, I expect the child database to open automatically.

What version of Keepass2Android are you using?

1.09e-r7

Which version of Android are you on?

13

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at KeeAutoExecExt.AutoOpenEntry and SelectCurrentDbActivity.OpenAutoExecEntries, then trace the key-file read through KeePassLib.Serialization.IOConnection.OpenRead and KeePassLib.Keys.KcpKeyFile.Construct. Reproduce the parent/child setup from the report on Android 13 and inspect why the key-file URI cannot be opened. Done means a child database protected by both password and key file opens automatically after the parent database is opened.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, csharp
Domain
mobile, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.