-
Notifications
You must be signed in to change notification settings - Fork 558
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
Handling passwords when stdin
is a pipe (as opposed to a TTY)
#525
Comments
Also, strangely even if |
Thanks for the detailed report! This does look incorrect. Would you like to give fixing this a try? I'd be happy to provide some pointers. |
I might give it a try (my assumption is to look in the However quickly looking through the source code I see that (I see that in the |
Hmm, I only see that in two places: cosign/cmd/cosign/cli/generate_key_pair.go Line 156 in 1f9d3d9
and cosign/pkg/cosign/pivkey/pivkey.go Line 196 in 9adaad5
We could reduce more, but one is for a PIN and one is for a password. It looks like the GetPass stuff is probably the right place to fix this. |
Closed, fixed with above |
At the moment (in
v1.0.0
) whenstdin
is a pipe (for examplesome-command-to-print-secret | cosign generate-key-pair
) the tool tries to read the password twice and fails to verify it. (I know there isCOSIGN_PASSWORD
, but I would like to avoid exposing it as an environment variable.)This is not exactly a "bug", more an "unexpected behaviour", since most tools that input passwords, if they detect a pipe (or anything that is not a TTY) as stdin, they just don't prompt for passwords and read it once.
How would I propose to handle it:
--password 'some-secret'
and--password-fd 7
(that can be used inbash
as--password-fd <( some-command-to-print-secret)
), that could be used to supply passwords; (noting that--password
is even worse security wise than environment variables;)cosign
without any flag or environment variable denoting passwords, and/dev/stderr
is not a TTY, then fail; (I say/dev/stderr
because one should always use that for TTY interaction, and because someone might just usestdin
as the blob to be signed;)The text was updated successfully, but these errors were encountered: