git-secret icon indicating copy to clipboard operation
git-secret copied to clipboard

git secret can hang on 'Enter passphrase' in certain situation(s)

Open appengineeringlab opened this issue 6 years ago • 10 comments

What are the steps to reproduce this issue?

  1. git secret hide file_name
  2. git secret reveal

What happens? It is stucked on Enter pashprase and when I hit enter nothing happens.

What were you expecting to happen? I was expecting hidden files to be revealed.

Any logs, error output, etc?

https://imgur.com/5QgHIXV

Any other comments? No other comments.

What versions of software are you using?

Operating system: (uname -a) 5.0.0-32-generic #34~18.04.2-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux

git-secret path: (which git-secret) /usr/bin/git-secret

git-secret version: (git secret --version) 0.2.2

git version: (git --version) git version 2.17.1

Shell type and version: ($SHELL --version) zsh 5.4.2 (x86_64-ubuntu-linux-gnu)

gpg version: (gpg --version) gpg (GnuPG) 2.2.4 libgcrypt 1.8.1

appengineeringlab avatar Nov 08 '19 01:11 appengineeringlab

@appengineeringlab there have been a lot of changes to git-secret since 0.2.2.

Can you please retry with the most recent release of git-secret, 0.3.2, and let us know the result?

joshrabinowitz avatar Nov 17 '19 14:11 joshrabinowitz

Everything is working now. Thanks.

appengineeringlab avatar Nov 25 '19 16:11 appengineeringlab

I was having the same issue on macOS Catalina 10.15.6 with git-secret 0.3.3. Prompted to enter pass phrase after calling git secret reveal, but then it just hangs. The issue is resolved by ... close the current shell and open a new one. The equivalent of blowing into an Atari cartridge.

FanchenBao avatar Feb 17 '21 22:02 FanchenBao

Same issue on macOS. Running on a new terminal works.

$ sw_vers
ProductName:	macOS
ProductVersion:	12.2.1
BuildVersion:	21D62

$ gpg --version
2.2.34

$ git secret --version
0.4.0

r13i avatar Apr 22 '22 05:04 r13i

This is not a random phenomenon, something is causing gnupg (not git-secret) to hang on the passphrase. I think this can be caused by sudo-ing from root to a normal user and then using git-secret. It would be good if we could enumerate the cases that can make this happen.

joshrabinowitz avatar Apr 22 '22 12:04 joshrabinowitz

I noticed that when this happen, and if I keep using the same terminal session for other commands that take user input, pressing the enter button (return ⏎) prints out ^M.

So I assume what is happening is this, instead of taking my input, it just appends ^M every time I press enter.

// e.g. gpg --decrypt ...
Enter passphrase: <my actual passphrase>^M^M

r13i avatar Apr 22 '22 13:04 r13i

That sounds like a terminal sync problem (I'm not sure the correct language to use). I've never seen that exact behavior.

This is good data though, let's figure out what conditions cause gnupg to hang waiting for the passphrase

joshrabinowitz avatar Apr 22 '22 13:04 joshrabinowitz

The same just happened to me now. Happy to provide more logs if needed. I'm using iTerm Build 3.4.15, zsh 5.8.1. When I quit the terminal and opened it again, it went through.

❯ g secret reveal -f
Enter passphrase:
gpg: signal Interrupt caught ... exiting

❯ g secret reveal -f
Enter passphrase:
gpg: signal Interrupt caught ... exiting

❯ git-secret --version
0.4.0
❯ gpg --version
gpg (GnuPG) 2.3.6
libgcrypt 1.10.1

❯ sw_vers
ProductName:	macOS
ProductVersion:	12.4
BuildVersion:	21F79

cattapan avatar May 28 '22 08:05 cattapan

@cattapan thank you for this issue report. Your particular problem is not specific to git-secret, and instead is particular to gnupg.

If you google "gpg: signal Interrupt caught ... exiting" (with the quotes) you can see this is a recurring issue people have with gnupg. Is it the case that gnupg is hanging on Enter passphrase? Are you typing cntl-C to cause the 'signal Interrupt caught' message from gnupg? Is there anything weird about your key(s)? Has the gnupg keyring used by git-secret been altered by multiple versions of gnupg?

You say "When I quit the terminal and opened it again, it went through" which leads me to believe it's some sort of terminal/terminal emulation issue, or temporary user permissions issue (maybe you su-ed or similar to change users before encountering this error)?

I suspect that the way to debug your issue is to read similar bug reports carefully, and/or to spelunk through the gnupg source and figure out what's going on in your case. In general, if we have steps to replicate problems (and not a brief report of the final error) that makes these much easier to debug.

Moving forward, can people please add new github issues if they are encountering these sorts of issues, and ideally add more information about how to replicate? Again, I believe this issue is really about gnupg and not git-secret proper.

joshrabinowitz avatar May 28 '22 14:05 joshrabinowitz

I'm using m1 mac Monterey and iterm2. I had same situation too. I couldn't type passphrase. At first, I was confused. but I clicked Key Icon next to the Enter passphrase text, password window was open. and it works.

See my capture.

enter_passphrase

heyask avatar Sep 29 '22 13:09 heyask