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

Cosign crashes when password input is requested from terminal in Windows #1153

Closed
gjirm opened this issue Dec 7, 2021 · 3 comments · Fixed by #1657
Closed

Cosign crashes when password input is requested from terminal in Windows #1153

gjirm opened this issue Dec 7, 2021 · 3 comments · Fixed by #1657
Labels
bug Something isn't working

Comments

@gjirm
Copy link

gjirm commented Dec 7, 2021

On Windows when password should be read from terminal, application immediately crashes with the following error:

Enter password for private key:
Error: The handle is invalid.
main.go:46: error during command execution: The handle is invalid.

For example when running these commands:

cosign generate-key-pair
cosign sign --key cosign.key ...

I think it is related to the bug #862 I previously reported.

My environment

  • Windows 11 (21H2 - build 22000.318), Windows 10 (21H2 - build 19044.1348)
  • cosign v1.4.0
  • Window Terminal v1.11.2921.0
    • native cmd.exe
    • PowerShell 7.2.0
@dekkagaijin
Copy link
Member

@gjirm I wasn't able to reproduce the issue. Would you be able to add a test case to https://github.com/sigstore/cosign/blob/main/test/e2e_test.ps1 that provokes the bug?

@gjirm
Copy link
Author

gjirm commented Dec 13, 2021

@gjirm I wasn't able to reproduce the issue. Would you be able to add a test case to https://github.com/sigstore/cosign/blob/main/test/e2e_test.ps1 that provokes the bug?

@dekkagaijin Unfortunately, I don't know how to add a test case, because it only happens to me if I run the command without entering a password (via a environment variable or via a pipe). See example below for cosign generate-key-pair:

cosign_bug_1153

@jowko
Copy link

jowko commented Feb 9, 2022

I also have similar issue. I use Windows 10 Pro. I downloaded v1.5.1 version of cosign.
When I run cosign generate-key-pair in PowerShell/cmd i get such thing:

Enter password for private key: Error: The handle is invalid.
main.go:46: error during command execution: The handle is invalid.

When I run the same command in git bash, then bash hangs and I need to kill this command:

$ cosign generate-key-pair -d

Providing password via environment variable resolves this issue.

mdp added a commit to mdp/cosign that referenced this issue Mar 25, 2022
While is is 0 on Unix, it's not on Windows. Golang handles this with the
syscall.Stdin targeting Windows.
mdp added a commit to mdp/cosign that referenced this issue Mar 25, 2022
While is is 0 on Unix, it's not on Windows. Golang handles this with the
syscall.Stdin targeting Windows.

Signed-off-by: Mark Percival <[email protected]>
mdp added a commit to mdp/cosign that referenced this issue Mar 25, 2022
While is is 0 on Unix, it's not on Windows. Golang handles this with the
syscall.Stdin targeting Windows.

Signed-off-by: Mark Percival <[email protected]>
mdp added a commit to mdp/cosign that referenced this issue Mar 25, 2022
While is is 0 on Unix, it's not on Windows. Golang handles this with the
syscall.Stdin targeting Windows.

Signed-off-by: Mark Percival <[email protected]>
mdp added a commit to mdp/cosign that referenced this issue Mar 25, 2022
While is is 0 on Unix, it's not on Windows. Golang handles this with the
syscall.Stdin targeting Windows.

Signed-off-by: Mark Percival <[email protected]>
dlorenc pushed a commit that referenced this issue Mar 25, 2022
While is is 0 on Unix, it's not on Windows. Golang handles this with the
syscall.Stdin targeting Windows.

Signed-off-by: Mark Percival <[email protected]>
mlieberman85 pushed a commit to mlieberman85/cosign that referenced this issue May 6, 2022
While is is 0 on Unix, it's not on Windows. Golang handles this with the
syscall.Stdin targeting Windows.

Signed-off-by: Mark Percival <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants