keepassxreboot / keepassxc

KeePassXC is a cross-platform community-driven port of the Windows application “Keepass Password Safe”.
https://keepassxc.org/
Other
21.4k stars 1.48k forks source link

Quick Unlock stops working with Watch-ID after sleep #8880

Closed findus closed 1 year ago

findus commented 1 year ago

Overview

Unlocking KeepassXC with the apple watch works flawlessly until my Macbook enters sleep. After that only Touch-ID continues working.

Steps to Reproduce

  1. Use a Macbook with an Apple-Watch attached, enable that DB should be blocked after sleep/lock
  2. Unlock the Database and lock it again, quick unlock with the apple watch should work.
  3. Let the mac sleep by closing the lid or click the sleep menu entry
  4. Resume from sleep and click the quick unlock button

Expected Behavior

Watch-ID should also work after sleep

Actual Behavior

Watch-ID stops working after sleep

Context

I tried to debug the problem with the current master branch but I am not really that technically savvy with C++ and the used APIs from Macos. Does the App needs to be signed to have access to the Keychain?

KeePassXC - Version 2.7.4 Revision: 63b2394

Qt 5.15.6 Debugging mode is disabled.

Operating system: macOS 13.0 CPU architecture: arm64 Kernel: darwin 22.1.0

Enabled extensions:

Cryptographic libraries:

Operating System: macOS

droidmonkey commented 1 year ago

The program needs to be signed to access the keychain. Not sure why touchid would work and not watch after sleep, they use the same exact method for storing and retrieving keys. This could be a bug on macos side. Does watch work again after canceling quick unlock and doing a full unlock again?

findus commented 1 year ago

Hi,

After writing this Bug Report I could not quite reproduce it again as I was able to before. It seems a very inconsistent interaction with a docking station.

After you answered I tried to test what you mentioned only to find out that now everything worked out perfectly. I attached the mac to a Dock and let it sleep for few hours and as I woke up I unlocked it and tried again -> still success.

I am not that familiar with the implementation details but keepass- or the macos side might sometimes get confused if Touch-ID devices (Watch, Fingerprint-Sensor) are getting inaccessible or vice versa, especially if the laptop is sleeping while (un)plugging something.

Sometimes macos then seems to forget that the Watch is still connected and reports that only Touch-ID is available, when the mac is connected to a dock and the lid is closed the macos implementation assumes that the button is inacessible and responds to keepass that no touch-id hardware is currently available, so keepass only shows the password-textfield.

Examples that I managed to reproduce:

Sometimes after I do anything above the watch ocassionally stops working and I have to restart the mac to get it back to work for keepass (the watch still works for user session unlocking), touch-id works all the time as long as the lid is open, right now it seems random to me but maybe I’ll find a pattern at some time.

Touch-ID only or Touch- and Watch-ID prompt touch-id-watch-id-prompt

Watch-ID only prompt (if lid is closed) watch-id-only-prompt-with-pw-prompt

droidmonkey commented 1 year ago

This isn't something we can fix, unfortunately. It would appear to be a macos problem at this time. We just call their APIs to kick everything off.