KeePassium icon indicating copy to clipboard operation
KeePassium copied to clipboard

OneDrive shared kdbx file loading fails

Open OculiViridi opened this issue 1 year ago • 9 comments

Description I have multiple kdbx files stored on OneDrive premium cloud service and one of them is a shared file from another OneDrive premium cloud service account. The OneDrive share works as excepted, so I see the file and I can download and open it without issues for about a couple of years. It worked until about a couple of months ago, then someday I started to see the following message below the shared file:

The resource could not be found

As said, the file is ok and it is reachable from everywhere: OneDrive web, OneDrive iOS app, OneDrive PC application, iOS iFile, etc.. I haven't made any change to the share or something.

So, first I tried to remove the file from KeePassium and add it again using the "Connect to server - OneDrive" function. And the strange thing is that the file is correctly taken and loaded into KeePassium the first time, but then, after the first opening, every time I open the app, the error message appears. So I decided to try to remove and recreate the share for the file from OneDrive, but nothing changed. Other kdbx files have been loaded into KeePassium the same way using "Connect to server - OneDrive" function and they're not affected by the issue. The only difference is "regular" file vs shared. The same issue is present on my wife's iPhone with the same KeePassium app version, related to another OneDrive shared kdbx file.

How to reproduce Steps to reproduce the behavior:

  1. Share a kdbx file from one OneDrive account to another.
  2. Add the shared kdbx file into KeePassium using "Connect to server - OneDrive" function.
  3. Open the db file the first time, everything seems to be ok.
  4. Close the app, reopen it and when syncing, you see the error: The resource could not be found.

Expected behavior It should works like it was till a couple of months ago, so just like any other kdbx file.

Screenshots A screenshot of the error message that appears every time I open the app.

20240920_082535763_iOS

Environment:

  • Device: iPhone XS
  • OS: iOS 16.6.1 and iOS 18
  • App Version: 1.52 and 1.53.154

OculiViridi avatar Sep 20 '24 08:09 OculiViridi

@OculiViridi , thank you for the report. This is likely a regression after introducing Dropbox and GDrive integration.

Much of the code between the three was the same and was moved to shared classes. I remember some OneDrive parameters (related to shared files) seemed redundant during the process. They were removed and everything continued to work without them — including the shared files. Apparently, they were not that redundant after all…

That said, I struggle to reproduce the error:

  • Is the file owned/hosted by a personal or a business OneDrive account?
  • Is only the file shared or its whole folder?
  • Are you accessing it via a personal or business OneDrive account?
  • Just to confirm, the error shows up immediately after relaunching the app, not after hours/days?

keepassium avatar Sep 20 '24 13:09 keepassium

  • Is the file owned/hosted by a personal or a business OneDrive account?

In my case they are both OneDrive premium (paid, not free) accounts, but not business.

  • Is only the file shared or its whole folder?

It's a share set on the single kdbx file.

  • Are you accessing it via a personal or business OneDrive account?

Both are accessed via OneDrive personal (but premium/paid) accounts.

  • Just to confirm, the error shows up immediately after relaunching the app, not after hours/days?

I realize now that the description of this aspect wasn't entirely correct, because actually, the message appears immediately after the first time the file is open after the download. When the db is opened, in fact, I already see the message "The database is not reachable. This is the latest local copy." and when I get back to the db list I see the "The resource could not be found." error below the filename.

OculiViridi avatar Sep 20 '24 14:09 OculiViridi

@OculiViridi , thank you for the details!

I've managed to reproduce the issue with shared files on personal OneDrive accounts. But in my case the error says "ObjectHandle is Invalid", so it looks like a different — although possibly related — problem. There is a good chance that fixing the "object handle" bug would also fix the "resource not found" one as a side effect, but it would be nice to test the fix on both.

These were my steps to replicate the issue:

  • Let Alice and Bob be two OneDrive users with personal accounts. Both are free accounts (the issue remained even after Bob's upgrade later on, so this likely does not matter).
  • Alice's side:
    • She has a shared.kdbx in her OneDrive's standard Documents folder.
    • She right-clicks (in web interface) the file → Share → enters Bob's email and clicks "Send"
  • Bob's side:
    • KeePassium → Connect to Server → OneDrive → proceeds with sign-in
    • He selects Shared folder and selects shared.kdbx there
    • He taps "< Back" to leave the database unlocking dialog and observes "ObjectHandle is Invalid" below the file name.

In general terms, this looks similar to your steps, except the message is different.

I suspect the difference is caused by some detail on Alice's or Bob's side: whether Alice's database is in Documents, or OneDrive root, or some deep subfolder, and whether Bob selects the shared file directly from Shared root, or some folder in there, or even mapped somewhere among his Files (rather than Shared).

Does your procedure look the same as above, or there are some intermediate folders?

keepassium avatar Sep 24 '24 21:09 keepassium

@keepassium

The steps seems to be the same I did. The share is applied on the single kdbx file that is inside a non-shared folder. -> OK From KeePassium, the file is picked from the OndeDrive Shared default folder. -> OK

However, there is a small difference, which I don't know if it can influence. The share I created for the file in OneDrive is "read only" type...

OculiViridi avatar Sep 25 '24 08:09 OculiViridi

@OculiViridi , I've been looking into this for a few hours now, and found a possible workaround.

Try moving the database to a folder and share that folder instead of the file itself. Basically, you should find the file via Connect to Server → One Drive → Shared → Folder name → database.kdbx.

Does this work on your side?

keepassium avatar Dec 12 '24 22:12 keepassium

@keepassium Hi there! Sorry for the big delay!

I tried your suggestion and if that was a workaround, then yes, it works. Thanks! Anyway, it may be a "problem" (at least for me) to have the KeePass file on a shared folder, especially if I have multiple KeePass files. Now they are shared each one individually when needed and with who need them. Working with shared folders instead, will require me to create a folder for each KeePass file or group of files, depending on the specific sharing needs.

OculiViridi avatar Jan 14 '25 20:01 OculiViridi

@OculiViridi , thanks for the feedback. Yeah, folders are only a ~kludge~ workaround, the issue remains open until solved properly.

keepassium avatar Jan 23 '25 15:01 keepassium

deal breaker issue. the one and only reason i use this app, and i suspect others do, is that I need a way to manage my passwords across multiple platforms. having to go through such a fiddly process to gain access to KBDX files on iOS when it is so easy on Android, OSX and Windows has driven me to try other applications.

Xarmoda avatar Feb 16 '25 00:02 Xarmoda

I am not even sure whether we keep breaking it or Microsoft keeps changing API behavior, but it is broken again. Reopening.

deal breaker issue

The issue discussed here is that KeePassium fails to load the database when all of the following conditions combine:

  • The database is in OneDrive, and
  • The file is shared with you by someone, and
  • The file is located directly in "Shared with me" folder, and
  • You use the in-app direct connection to sync it.

If moving a database to a subfolder or syncing via Files app is a deal breaker issue — I am happy you had other applications to switch to :)

keepassium avatar Nov 03 '25 18:11 keepassium