Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows Hello window not in focus when KeePass opened through a shortcut #86

Open
4 of 7 tasks
c0m1c5an5 opened this issue Jan 12, 2022 · 9 comments
Open
4 of 7 tasks

Comments

@c0m1c5an5
Copy link

c0m1c5an5 commented Jan 12, 2022

Describe the bug

When opening KeePas from locked state via a shortcut (Ctrl+Alt+A in my case), resulting Windows Hello window is not in foreground and does not have focus on it. This causes reading fingerprint to fail until I manualy select Windows Hello window to make it in focus.

To Reproduce

Steps to reproduce the behavior:

  1. Lock KeePass database, so accessing it requires authentication.
  2. Open any aplication that has autofill enabled.
  3. Use autofill shortcut.
  4. Resulting Windows Hello window is in background and not in focus.

Expected behavior

Windows Hello window must be on top and in focus.

Screenshots

Windows Hello window opened in background and not in focus.

screenshot

Context

Component Version
Operating System Windows 10 Pro 10.0.19041
KeePass 2.50
Plugin 3.2

Hardware info

  • Motherboard: Asus TUF Gaming B450M-PRO II
  • DigitalPersona U.are.U 4500
  • TPM module info None (No module found)

Plugin settings

  • Is persistent mode enabled ("Store keys in Windows Credential Manager" checked)
  • Results are the same if persistent mode is disabled

KeePass settings and environment

  • Is secure desktop enabled
  • Is KeePass running under Administrator (in elevated process)
  • Was it right after hibernation
  • Was KeePass minified or closed
  • No additional plugins installed

Additional context

If I open KeePass application, Windows Hello window is in foreground and in focus as expected.
But the same does not happen when KeePass is opened through a shortcut.

@SteveDax
Copy link

The same applies when using KeeAgent Plugin. If you start a SSH connection while KeePass is locked, SSH seems to hang. Meanwhile the WinHello Prompt is waiting hidden behind the Terminal window.

@c0m1c5an5
Copy link
Author

As it turns out, KeepassXC has windows hello feature built-in. So if you are not tied to strictly using regular KeePass, than I would recommend switching over to KeepassXC.

@me4175
Copy link

me4175 commented Jul 30, 2022

It would really be great to have this fixed.

@Bilemma
Copy link

Bilemma commented Sep 8, 2022

I also have this issue (KeePass 2.51.1 64Bit and KeePassWinHello 3.2). I recently noted that it doesn't occur when I'm entering my hot key for "show KeePass window":

  • hot key "Global auto-type": The WinHello-Prompt doesn't get the focus and is somewhere in the background
  • hot key "show KeePass window": The WinHello-Prompt is in front and everything works like a charme...

Maybe this helps for locating the problem in the code. Because the issue is quite annoying it would be great to get this fixed soon! Thank you!!

@Bilemma
Copy link

Bilemma commented Jan 25, 2023

I did some research and may have approached the problem. I found these lines in the Code of the main KeePass Software (v 2.53):

KeePass: MainForm_Functions.cs - line 2962:

internal void HandleHotKey(int wParam)
		{
			if(HotKeyManager.HandleHotKeyIntoSelf(wParam)) return;

			if(wParam == AppDefs.GlobalHotKeyId.AutoType)
				ExecuteGlobalAutoType();
			else if(wParam == AppDefs.GlobalHotKeyId.AutoTypePassword)
				ExecuteGlobalAutoType(@"{PASSWORD}");
			else if(wParam == AppDefs.GlobalHotKeyId.AutoTypeSelected)
				ExecuteEntryAutoType();
			else if(wParam == AppDefs.GlobalHotKeyId.ShowWindow)
			{
				bool bWndVisible = ((this.WindowState != FormWindowState.Minimized) &&
					!IsTrayed());
				EnsureVisibleForegroundWindow(true, true);
				if(bWndVisible && IsFileLocked(null))
					OnFileLock(null, EventArgs.Empty); // Unlock
			}
			else if(wParam == AppDefs.GlobalHotKeyId.EntryMenu)
				EntryMenu.Show();
			else { Debug.Assert(false); }
		}

So only for the ShowWindow-Command the visibility check is done. This makes sense in all normal cases but with WinHello it causes the stated problem I guess.

I don't know if there is a possibility to bring the Windows Hello form to the front from inside the WinHello-Code or if we have to jump over to the KeePass Bug report area. Could please someone with more experience comment on that? Thanks for helping out!

@ygoe
Copy link

ygoe commented Mar 17, 2023

I always get the PIN entry window from Windows Hello in the foreground, but after completing this, the account selection window from KeePass is in the background. So still a window focus issue, but at another time.

@loeffelpan
Copy link

I just set up my new Laptop with fingerprint sensor and would love to use this to unlock KeePass. But with this focus bug its annoying.

Any update on this?
Did or can some one investigate this further?

@ygoe
Copy link

ygoe commented Dec 1, 2023

No, lost interest because it works much better with KeePassXC.

@sirAndros
Copy link
Owner

related: #25

sirAndros added a commit that referenced this issue Apr 1, 2024
@sirAndros sirAndros mentioned this issue Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants