Skip to content

Commit

Permalink
feat: replace x/crypto/ssh with x/term (#42817)
Browse files Browse the repository at this point in the history
* feat: replace x/crypto/ssh with x/term

x/crypto/ssh/terminal is deprecated and moved to x/term

removing x/crypto usage also makes it easier to review fips compliance

* Update password.go

* Update password.go

* Update password.go

* Update password.go

* Update password.go
  • Loading branch information
kruskall authored Feb 21, 2025
1 parent 2f3df16 commit b29f777
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions libbeat/common/cli/password.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@
package cli

import (
"errors"
"fmt"
"os"
"strings"
"syscall"

"errors"

"golang.org/x/crypto/ssh/terminal"
"golang.org/x/term"
)

type method func(m string) (string, error)
Expand Down Expand Up @@ -61,11 +59,13 @@ func ReadPassword(def string) (string, error) {
}

func stdin(p string) (string, error) {
//nolint:forbidigo // ignore
fmt.Print("Enter password: ")
bytePassword, err := terminal.ReadPassword(int(syscall.Stdin))
bytePassword, err := term.ReadPassword(int(os.Stdin.Fd()))
if err != nil {
return "", fmt.Errorf("reading password input: %w", err)
}
//nolint:forbidigo // ignore
fmt.Println()
return string(bytePassword), nil
}
Expand Down

0 comments on commit b29f777

Please sign in to comment.