From d04d02b0b2ebfd0d3337a6369ad4744877da010d Mon Sep 17 00:00:00 2001 From: liuchengkun Date: Tue, 24 Aug 2021 09:17:33 +0800 Subject: [PATCH 1/4] fix password reading from stdin --- jiracli/password.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jiracli/password.go b/jiracli/password.go index 1baa986f..032363c9 100644 --- a/jiracli/password.go +++ b/jiracli/password.go @@ -3,7 +3,6 @@ package jiracli import ( "bytes" "fmt" - "io/ioutil" "os" "os/exec" "strings" @@ -118,11 +117,12 @@ func (o *GlobalOptions) GetPass() string { } } else if o.PasswordSource.Value == "stdin" { log.Info("Reading password from stdin.") - allBytes, err := ioutil.ReadAll(os.Stdin) + var buffer [512]byte + nBytes, err := os.Stdin.Read(buffer[:]) if err != nil { panic(fmt.Sprintf("unable to read bytes from stdin: %s", err)) } - o.cachedPassword = string(allBytes) + o.cachedPassword = string(buffer[:nBytes-1]) } else { log.Warningf("Unknown password-source: %s", o.PasswordSource) } From 0eb8de5958262f95e9ee384821fcfa44fe746fc6 Mon Sep 17 00:00:00 2001 From: liuchengkun Date: Tue, 24 Aug 2021 09:18:06 +0800 Subject: [PATCH 2/4] add --passwordsource global option --- jiracli/cli.go | 1 + 1 file changed, 1 insertion(+) diff --git a/jiracli/cli.go b/jiracli/cli.go index d834520a..f0e03001 100644 --- a/jiracli/cli.go +++ b/jiracli/cli.go @@ -166,6 +166,7 @@ func register(app *kingpin.Application, o *oreo.Client, fig *figtree.FigTree) { app.Flag("socksproxy", "Address for a socks proxy").SetValue(&globals.SocksProxy) app.Flag("user", "user name used within the Jira service").Short('u').SetValue(&globals.User) app.Flag("login", "login name that corresponds to the user used for authentication").SetValue(&globals.Login) + app.Flag("passwordsource", "Method to fetch the password").SetValue(&globals.PasswordSource) o = o.WithPreCallback(func(req *http.Request) (*http.Request, error) { if globals.AuthMethod() == "api-token" { From a86a0af02ba2c4e66d748d7c586fbe2ff28ec102 Mon Sep 17 00:00:00 2001 From: liuchengkun Date: Thu, 9 Sep 2021 13:19:21 +0800 Subject: [PATCH 3/4] fix: make fork go.mod work --- go.mod | 2 ++ 1 file changed, 2 insertions(+) diff --git a/go.mod b/go.mod index 9cca9267..91ee57c7 100644 --- a/go.mod +++ b/go.mod @@ -48,3 +48,5 @@ require ( gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473 gopkg.in/yaml.v2 v2.2.2 // indirect ) + +replace github.com/go-jira/jira => github.com/chuckliu1979/jira v1.0.29 //indirect From 8d6f1dc54617e672d7bce617f8428f7ad4a3be59 Mon Sep 17 00:00:00 2001 From: liuchengkun Date: Thu, 9 Sep 2021 13:21:14 +0800 Subject: [PATCH 4/4] fix: use new tag --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 91ee57c7..878f6192 100644 --- a/go.mod +++ b/go.mod @@ -49,4 +49,4 @@ require ( gopkg.in/yaml.v2 v2.2.2 // indirect ) -replace github.com/go-jira/jira => github.com/chuckliu1979/jira v1.0.29 //indirect +replace github.com/go-jira/jira => github.com/chuckliu1979/jira v1.0.30 //indirect