nullpo-head / WSL-Hello-sudo

Let's sudo by face recognition of Windows Hello on Windows Subsystem for Linux (WSL). It runs on both WSL 1 and WSL 2. This is a PAM module for Linux on WSL.
MIT License
1.21k stars 46 forks source link

With Hyper terminal, Windows Hello Auth appears in background #4

Closed OscBacon closed 2 years ago

OscBacon commented 5 years ago

Whenever I call sudo in hyper terminal, the authentication window appears in the background, and I have to switch to it with with Alt + Tab.

RedBeard0531 commented 5 years ago

This also happens for mintty and cmd

nullpo-head commented 5 years ago

Unfortunately, that doesn't reproduce in my environment. I'm glad if you could find out how to reproduce it. I have experienced it once, so I'm sure that happens in some situation, though.

haotian-wang commented 5 years ago

This also happens for my Windows Terminal, cmd, and powershell. Windows version: 1903 (18362.356)

piotrmocko commented 4 years ago

Same issue on Windows Terminal 1.0 on Windows version: 1909. But it works on ConEmu.

nullpo-head commented 4 years ago

Hi, I've encountered the same situation in one of my laptops, which runs Windows Terminal 1.0 on Windows 1909. Restarting the machine solved the problem in my case. Please try restarting your machine when you have this problem. If the problem persists, I think it's worth submitting a bug ticket to somewhere of .NET Framework.

piotrmocko commented 4 years ago

I have this problem since I started using Windows Terminal 0.6 so it is already a few months and restart doesn't help.

piotrmocko commented 4 years ago

I've opened an issue in Windows Terminal issues tracker. Please upvote it and add comments with your environments if you experience the same issue https://github.com/microsoft/terminal/issues/6268

nullpo-head commented 4 years ago

I've opened an issue in .Net Developer community. https://developercommunity.visualstudio.com/content/problem/1057256/windows-hellos-keycredentialmanager-popup-appears.html I guess it's a problem of .NET API. Your votes will help to prioritize it. Thanks.

JacobDB commented 3 years ago

@nullpo-head looks like as of 11/4 that issue was closed 😕

piotrmocko commented 3 years ago

After updating Windows 10 to 20H2 and installing the following two updates, the problem has disappeared for me

JacobDB commented 3 years ago

@piotrmocko I just get "This update is no applicable for your system" when I try to install either of those (tried by x86 and x64). Running 20H2 on a brand new machine that I set up yesterday.

piotrmocko commented 3 years ago

These updates are in my Windows 10 updates history and I'm 90% sure that after installing them the issue was resolved. I did not download them from the Microsoft website. They have appeared in my Windows Update

jonaskuske commented 3 years ago

I have both of these installed and it changes nothing. :(

piotrmocko commented 3 years ago

Unfortunately, it stopped working for me too. I did not install any new update. So, I was lucky to have it working for a few days.

ram02z commented 3 years ago

Anyone have a fix?

crispinb commented 3 years ago

This happens for me with every invocation (though I'm using Windows Terminal). Reboots don't make a difference in my case.

y-batsianouski commented 3 years ago

Same issue with Win10 20H2 with all updated installed and Windows Terminal 1.6.10571.0

PhyX-Meow commented 3 years ago

Any news?

danepowell commented 3 years ago

Seems like this could be the relevant upstream issue: https://github.com/microsoft/terminal/issues/2988

TrentonAdams commented 3 years ago

This pam module doesn't really do much if it doesn't foreground the windows hello prompt.

just4747 commented 2 years ago

So was this never fixed? I am on Windows 11 now and just like on 10, whenever my SafeInCloud PW manager app/Chrome plug-in requires Windows Hello Fingerprint authentication to auto-fill browser passwords, the Windows Hello Fingerprint Auth Window (most of the time) comes up in the background of other windows (usually the separate SafeInCloud login window itself) and I have to manually click the Hello window from the taskbar to get it in focus/foreground before it will recognize that I am putting my fingerprint on the reader. Super frustrating.

The only way I've mostly fixed this (workaround) for now is to use the Windows app DeskPins which runs in the taskbar and you can set up an auto-pin rule in its settings where anytime it sees a specific window (you specify the app/event), it will auto-pin it so that it forces it to stay in the foreground over any other app. You can set up a rule specifically for the Windows Security/Windows Hello authentication window. This actually solves the problem of it automatically going right to the background unless you have another app pinned with DeskPins, but otherwise it works so far.

nullpo-head commented 2 years ago

The only way I've mostly fixed this (workaround) for now is to use the Windows app DeskPins which runs in the taskbar and you can set up an auto-pin rule in its settings where anytime it sees a specific window (you specify the app/event), it will auto-pin it so that it forces it to stay in the foreground over any other app. You can set up a rule specifically for the Windows Security/Windows Hello authentication window.

Oh, perhaps does it mean the WindowsHello windows can be manipulated with win32API just like normal windows? I thought it cannot be just like you cannot touch the UAC dialog window by win32 API. If it's possible simply setting the Windows Hello window foreground might solve the problem. Anyone interested in making a PR? 😋

plusls commented 2 years ago

Any progess?

jonaskuske commented 2 years ago

Just hacked around a little, the Windows Hello window can be brought to the foreground through a simple PowerShell script!

$sig = '[DllImport("user32.dll")] public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);'
Add-Type -MemberDefinition $sig -name NativeMethods -namespace Win32
$hwnd = (Get-Process CredentialUIBroker).MainWindowHandle
[Win32.NativeMethods]::ShowWindowAsync($hwnd, 2) # minimize
[Win32.NativeMethods]::ShowWindowAsync($hwnd, 9) # restore, brings to foreground

And there's also a native Rust crate for the Windows API, so this might actually be quite doable! Will give it a shot soon :)

just4747 commented 2 years ago

Just hacked around a little, the Windows Hello window can be brought to the foreground through a simple PowerShell script!

$sig = '[DllImport("user32.dll")] public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);'
Add-Type -MemberDefinition $sig -name NativeMethods -namespace Win32
$hwnd = (Get-Process CredentialUIBroker).MainWindowHandle
[Win32.NativeMethods]::ShowWindowAsync($hwnd, 2) # minimize
[Win32.NativeMethods]::ShowWindowAsync($hwnd, 9) # restore, brings to foreground

And there's also a native Rust crate for the Windows API, so this might actually be quite doable! Will give it a shot soon :)

How would you use this exactly? Do you mean create this as a ps1 file and run it in PS once and it takes care of the issue?

jonaskuske commented 2 years ago

@just4747 You can't use it, it was just a proof-of-concept showing that the Win32 APIs can be used to interact with the Windows Hello window.

To actually make it usable, the .exe used by WSL-Hello-sudo needs to call the respective APIs, which I implemented in https://github.com/nullpo-head/WSL-Hello-sudo/pull/27. If you want, you can clone and build my branch https://github.com/jonaskuske/WSL-Hello-sudo/tree/fix/hello-foreground, run the install.sh and you'll have the fixed version that moves the Hello popup to the foreground. :)

nullpo-head commented 2 years ago

I guess @jonaskuske just has fixed this long-standing issue. Kudos to @jonaskuske! Please report if the problem still persists.

just4747 commented 2 years ago

I'm confused, how is the fix implemented for people watching this/having the issue? Is there some update we can integrate or something? Sorry - unsure how this works.

danepowell commented 2 years ago

Is there some update we can integrate?

Install / upgrade to the new release: https://github.com/nullpo-head/WSL-Hello-sudo/releases/tag/v1.4.0

just4747 commented 2 years ago

Is there some update we can integrate?

Install / upgrade to the new release: https://github.com/nullpo-head/WSL-Hello-sudo/releases/tag/v1.4.0

Thanks. New release of what exactly? Isn't this all part of the Windows Hello part of Windows 11? Is this installable on a regular Windows installation or is this for Linux only/other? I'm sorry, I'm not familiar with what to do with the files on from github. OR is this specific to this Hyper Terminal software? I thought this was regarding the Windows Hello issue in general on Windows 11. I am having the problem with Windows Hello with any app that utilizes it for authentication.

jonaskuske commented 2 years ago

@just4747

This is only for Linux, the entire (and only) purpose of this tool is to open Windows Hello whenever you run the sudo command in Linux.

I thought this was regarding the Windows Hello issue in general on Windows 11. I am having the problem with Windows Hello with any app that utilizes it for authentication.

I'm not aware of any general issue like that. I only have this issue with the Linux integration, which the latest update here fixes. It already works perfectly fine when other applications open Windows Hello, like Microsoft Edge or 1Password.

just4747 commented 2 years ago

@just4747

This is only for Linux, the entire (and only) purpose of this tool is to open Windows Hello whenever you run the sudo command in Linux.

I thought this was regarding the Windows Hello issue in general on Windows 11. I am having the problem with Windows Hello with any app that utilizes it for authentication.

I'm not aware of any general issue like that. I only have this issue with the Linux integration, which the latest update here fixes. It already works perfectly fine when other applications open Windows Hello, like Microsoft Edge or 1Password.

Oh - that's unfortunate. I have this exact issue every single day with the Windows Hello fingerprint authentication popup in Windows 11, just using it with native Windows apps like SafeInCloud. Every time the Windows Security authentication window pops up it goes immediately to the background behind the prior app's window. I thought this was about this issue in general (at least one of the other now closed threads mentioned it). Oh well..