Add terminal package with secure ReadPassword helper
Provides echo-suppressed password prompting via golang.org/x/term for CLI login commands. Added as a platform standard in engineering-standards.md. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
14
terminal/terminal_test.go
Normal file
14
terminal/terminal_test.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package terminal
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestReadPasswordNotATTY(t *testing.T) {
|
||||
// When stdin is not a terminal (e.g. in CI), ReadPassword should
|
||||
// return an error rather than hanging or panicking.
|
||||
_, err := ReadPassword("Password: ")
|
||||
if err == nil {
|
||||
t.Fatal("expected error when stdin is not a terminal")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user