geluk / pass-winmenu

An easy-to-use password manager for Windows, compatible with pass.
MIT License
385 stars 25 forks source link

Acces denied #99

Closed adelplace closed 2 years ago

adelplace commented 2 years ago

Hello,

The application won't decrypt passwords anymore (It was working yesterday).

image

I tried to run it as admin but it didn't change anything.

[19:57:17.717] [DBG] ------------------------------
[19:57:17.718] [DBG] Starting pass-winmenu v1.12
[19:57:17.718] [DBG] ------------------------------
[19:57:17.719] [DBG] Enabled security protocols: Tls, Tls11, Tls12, Tls13
[19:57:17.846] [DBG] Config reloading enabled
[19:57:17.911] [DBG] Attempting to detect the GPG installation directory
[19:57:17.912] [DBG] GPG executable found at the configured path. Assuming installation dir to be C:\opt\pass-winmenu\lib\GnuPG\bin
[19:57:18.060] [DBG] Calling GPG with "--version"
[19:57:18.102] [DBG] Using GPG version gpg (GnuPG) 2.2.6
[19:57:20.124] [WRN] gpg-connect-agent failed to produce any output within 2,00 seconds
[19:57:20.124] [WRN] gpg-agent is most likely unresponsive and will be restarted
[19:57:23.893] An unhandled exception occurred in a background task. Stack trace:
[19:57:23.895] AggregateException in :: - Sub-exceptions:
[19:57:23.897]   Win32Exception (Accès refusé) in :0:0
[19:57:23.897]     -> in System.Diagnostics.ProcessManager.OpenProcess -- :0:0
[19:57:23.897]     -> in System.Diagnostics.NtProcessManager.GetModuleInfos -- :0:0
[19:57:23.897]     -> in System.Diagnostics.NtProcessManager.GetFirstModuleInfo -- :0:0
[19:57:23.897]     -> in System.Diagnostics.Process.get_MainModule -- :0:0
[19:57:23.897]     -> in PassWinmenu.ExternalPrograms.ProcessWrapper.get_MainModuleName -- :0:0
[19:57:23.897]     -> in PassWinmenu.ExternalPrograms.Gpg.GpgAgent.<EnsureAgentResponsive>b__6_0 -- :0:0
[19:57:23.897]     -> in System.Linq.Enumerable+WhereArrayIterator`1.MoveNext -- :0:0
[19:57:23.897]     -> in System.Collections.Generic.List`1..ctor -- :0:0
[19:57:23.897]     -> in System.Linq.Enumerable.ToList -- :0:0
[19:57:23.897]     -> in PassWinmenu.ExternalPrograms.Gpg.GpgAgent.EnsureAgentResponsive -- :0:0
[19:57:23.897]     -> in PassWinmenu.ExternalPrograms.Gpg.GPG.ListSecretKeys -- :0:0
[19:57:23.897]     -> in PassWinmenu.Program+<>c__DisplayClass13_0.<RunInitialCheck>b__0 -- :0:0
[19:57:23.897]     -> in System.Threading.Tasks.Task.Execute -- :0:0
[19:57:25.889] [WRN] gpg-connect-agent failed to produce any output within 2,00 seconds
[19:57:25.889] [WRN] gpg-agent is most likely unresponsive and will be restarted

Any idea ?

Thanks

geluk commented 2 years ago

Hi @adelplace, this seems to be an issue in the code that checks if GPG is still responsive, which is used to work around a bug in GPG where GPG may stop responding to commands. I had thought (hoped?) that this bug would have been fixed at some point, but your logs seem to indicate it may still happen sometimes:

[19:57:20.124] [WRN] gpg-connect-agent failed to produce any output within 2,00 seconds
[19:57:20.124] [WRN] gpg-agent is most likely unresponsive and will be restarted

If you're able to reliably reproduce this issue, then the problem you're seeing here is really a result of another issue: Either GPG has become unresponsive, or the check pass-winmenu performs to make sure that GPG is still responsive is incorrect.

I've created a new test build that should resolve the error you're seeing here, but it's possible that one of the two causes I mentioned above are still present. In that case, you may see another error when decrypting, or decryption may take several seconds before succeeding. If this is the case, please let me know about it, because I'd like to resolve that as well.

You can download the test build here: https://ci.appveyor.com/api/buildjobs/0iypbt7p5ve2mb8c/artifacts/pass-winmenu%2Fbin%2FRelease%2Fpass-winmenu.exe The executable can be used as a drop-in replacement for your existing pass-winmenu.exe.

adelplace commented 2 years ago

I made some tests with your build (but the behavior is the same with the release one) and I found that the access denied error appairs only when I start the app manually. When I use the automatic start option I'm able to decrypt passwords only few second after my pc startup, then I've got an other error image

And in the logs I'm also stuck with this

[15:24:18.465] [WRN] gpg-connect-agent failed to produce any output within 2,00 seconds
[15:24:18.465] [WRN] gpg-agent is most likely unresponsive and will be restarted
[15:26:30.127] [WRN] gpg-connect-agent failed to produce any output within 2,00 seconds
[15:26:30.127] [WRN] gpg-agent is most likely unresponsive and will be restarted

By the way I've no issue to manually decrypt any gpg file using powershell

geluk commented 2 years ago

Thank you for investigating further. To narrow down the problem further I've disabled the responsiveness check temporarily, to determine whether the check itself is broken or if pass-winmenu calls GPG in a different manner (or perhaps a different executable) which causes it to not respond properly.

Can you try again with this build, and check if decryption works? https://ci.appveyor.com/api/buildjobs/8scvtiykdku36v41/artifacts/pass-winmenu%2Fbin%2FRelease%2Fpass-winmenu.exe

adelplace commented 2 years ago

Great now it's working well, even with a manual start :)

geluk commented 2 years ago

Thanks for checking! I think I'll remove the responsiveness check completely, because while it's supposed to work around a bug in GPG, I haven't seen that bug anymore in a long time, and your experience indicates that the workaround itself can break sometimes, which obviously isn't helpful.

You can continue using the version I linked above until I publish the next release, in which this issue will be fixed.

adelplace commented 2 years ago

Ok thanks for your support and all your work ! This app is really useful 👍