vvauth 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cmd/vauth/main.go CHANGED
@@ -1,8 +1,9 @@
1
1
  // Command vauth is the standalone Vault credentials helper: same commands
2
- // and flags as the vvauth npm package (cnyks runner).
2
+ // and flags as the vvauth npm package.
3
3
  package main
4
4
 
5
5
  import (
6
+ "bytes"
6
7
  "encoding/json"
7
8
  "fmt"
8
9
  "os"
@@ -110,10 +111,11 @@ func run(argv []string) error {
110
111
  command, args := args[0], args[1:]
111
112
  _, jsonOutput := dict["ir://json"]
112
113
  if command == "version" || command == "--version" {
113
- fmt.Println(buildVersion())
114
+ fmt.Println(strings.TrimPrefix(buildVersion(), "v"))
114
115
  return nil
115
116
  }
116
117
 
118
+ vvauth.Version = buildVersion()
117
119
  v, err := vvauth.New()
118
120
  if err != nil {
119
121
  return err
@@ -173,9 +175,13 @@ func run(argv []string) error {
173
175
  }
174
176
 
175
177
  func runCommand(argv []string) error {
178
+ if len(argv) > 0 && argv[0] == "--" {
179
+ argv = argv[1:]
180
+ }
176
181
  if len(argv) == 0 {
177
182
  return fmt.Errorf("run: missing command")
178
183
  }
184
+ vvauth.Version = buildVersion()
179
185
  v, err := vvauth.New()
180
186
  if err != nil {
181
187
  return err
@@ -192,10 +198,20 @@ func runCommand(argv []string) error {
192
198
  // otherwise (objects are still rendered as JSON).
193
199
  func respond(response any, jsonOutput bool) error {
194
200
  if text, ok := response.(string); ok && !jsonOutput {
195
- // cnyks --ir://raw writes String(response) without a trailing newline.
201
+ // Raw token output has no trailing newline.
196
202
  _, err := fmt.Fprint(os.Stdout, text)
197
203
  return err
198
204
  }
205
+ if jsonOutput {
206
+ var out bytes.Buffer
207
+ encoder := json.NewEncoder(&out)
208
+ encoder.SetEscapeHTML(false)
209
+ if err := encoder.Encode(response); err != nil {
210
+ return err
211
+ }
212
+ _, err := os.Stdout.Write(bytes.TrimSuffix(out.Bytes(), []byte("\n")))
213
+ return err
214
+ }
199
215
  encoder := json.NewEncoder(os.Stdout)
200
216
  encoder.SetEscapeHTML(false)
201
217
  return encoder.Encode(response)
package/go.mod CHANGED
@@ -1,16 +1,18 @@
1
1
  module github.com/131/vvauth/v2
2
2
 
3
- // version: 2.5.0
3
+ // version: 2.6.0
4
4
 
5
5
  go 1.22
6
6
 
7
7
  require (
8
- github.com/131/ssh-agent-crypt v1.3.3
9
- golang.org/x/crypto v0.31.0
8
+ github.com/131/ssh-agent-crypt v1.4.2
9
+ github.com/131/vauth-login v1.1.5
10
+ github.com/Masterminds/semver/v3 v3.5.0
10
11
  gopkg.in/yaml.v3 v3.0.1
11
12
  )
12
13
 
13
14
  require (
14
15
  github.com/Microsoft/go-winio v0.6.2 // indirect
16
+ golang.org/x/crypto v0.31.0 // indirect
15
17
  golang.org/x/sys v0.28.0 // indirect
16
18
  )
package/go.sum CHANGED
@@ -1,5 +1,15 @@
1
- github.com/131/ssh-agent-crypt v1.3.3 h1:+sITI4C55Ck5Kype/aKcn/6MoGeCfk9GshogF0LZgkI=
2
- github.com/131/ssh-agent-crypt v1.3.3/go.mod h1:XNiI2n3+2NTwjhyd/plFhrd0vSfWOZ58ocvqTlx1Ydk=
1
+ github.com/131/ssh-agent-crypt v1.4.1 h1:Ng6+kKhFkk6XvpCLT8+VhWH9J5wwh1wq4NlHsZwa4NA=
2
+ github.com/131/ssh-agent-crypt v1.4.1/go.mod h1:XNiI2n3+2NTwjhyd/plFhrd0vSfWOZ58ocvqTlx1Ydk=
3
+ github.com/131/ssh-agent-crypt v1.4.2 h1:e0srAUvSwbPaZXjkE2qY5OCWKxXNTCOVOVWyfrxhTM4=
4
+ github.com/131/ssh-agent-crypt v1.4.2/go.mod h1:/YBOMh8URU2lc5kTxjTDftcVrJqGv1SIpo0TjwNQPCA=
5
+ github.com/131/vauth-login v1.1.3 h1:XzwooJBhHIltt5PGRVoRXmgsrX6JTSNYPUNrG1O4SXM=
6
+ github.com/131/vauth-login v1.1.3/go.mod h1:+Z5ibQE3Wa1ouVSRaiH7t5ckNPlAcpx0j8C8KF+5Z9M=
7
+ github.com/131/vauth-login v1.1.4 h1:yv5+5m/0LNIDPlpFzfiKOiA5B6HH5bz1OfzfF9tRc/U=
8
+ github.com/131/vauth-login v1.1.4/go.mod h1:4jGHBN8aLgvbhvHGhw1U9jPbl/bfgJUgNyz+O9g3A90=
9
+ github.com/131/vauth-login v1.1.5 h1:Uho9fCexylScv5TBVlgctPGj/itVBjdvMFHjqsD4Xlg=
10
+ github.com/131/vauth-login v1.1.5/go.mod h1:R0CIG8+HiwdPEsE/VPvltiN7QSeoMuIN46YP/T8JtAw=
11
+ github.com/Masterminds/semver/v3 v3.5.0 h1:kQceYJfbupGfZOKZQg0kou0DgAKhzDg2NZPAwZ/2OOE=
12
+ github.com/Masterminds/semver/v3 v3.5.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
3
13
  github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
4
14
  github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
5
15
  golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=