Replaced the dependency github.com/howeyc/gopass#126
Replaced the dependency github.com/howeyc/gopass#126peterhaochen47 merged 2 commits intocloudfoundry:mainfrom
Conversation
|
In case of tests golang.org/x/term failing because stdin is not terminal as such in the case the input is not a terminal then a bufio.NewReader is used to read a line
6458370 to
3daa9bd
Compare
| setConfigAuthUrl(uaaServer.URL()) | ||
| session := runCommandWithStdin(strings.NewReader("user\npass\n"), "login") | ||
| Eventually(session.Out).Should(Say("username:")) | ||
| Eventually(session.Out).Should(Say(`password: \*\*\*\*`)) |
There was a problem hiding this comment.
Is there a replacement for this test, like in commands/set_test.go?
There was a problem hiding this comment.
Addressed the comment! However the behavior of prompt is different and although one will see the prompt password but the front of prompt will remain empty and also don't progress. So no * would be present on the password line.
| session := runCommandWithStdin(strings.NewReader("potatoes\n"), "set", "-n", "my-password", "-t", "password") | ||
|
|
||
| Eventually(string(session.Out.Contents())).Should(ContainSubstring("password: ********")) | ||
| Eventually(string(session.Out.Contents())).Should(ContainSubstring("password: ")) |
There was a problem hiding this comment.
Is it possible / easy to maintain the old output (********) which is broadly / conventionally understood as masked creds. The new output (just empty) does not signal the same thing and might be slightly confusing.
There was a problem hiding this comment.
Unfortunately there is not an option to keep the old output of *. But the prompt is enough common and looks like:
"In Go, the golang.org/x/term package provides functionalities to handle terminal input, including reading passwords securely. When using the ReadPassword function from this package, the terminal will typically mask the input, and the user might see a key symbol or asterisks instead of the characters they are typing. This is handled by the terminal itself in response to the settings applied by the ReadPassword function, rather than by the Go code directly displaying these symbols"

In case of tests golang.org/x/term failing because stdin is not terminal as such in the case
the input is not a terminal then a bufio.NewReader is used to read a line
The behavior of password prompt is different and mask
*wont be shown.