Skip to content

Commit 724a6f4

Browse files
committed
update codegen
Signed-off-by: cpanato <ctadeu@gmail.com>
1 parent bbc50b7 commit 724a6f4

File tree

8 files changed

+37
-28
lines changed

8 files changed

+37
-28
lines changed

third_party/VENDOR-LICENSE/github.com/cenkalti/backoff/v3/LICENSE

-20
This file was deleted.

third_party/VENDOR-LICENSE/github.com/hashicorp/vault/api/client.go

+27-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"crypto/tls"
1111
"encoding/base64"
1212
"encoding/hex"
13+
"encoding/json"
1314
"fmt"
1415
"net"
1516
"net/http"
@@ -41,6 +42,7 @@ const (
4142
EnvVaultClientCert = "VAULT_CLIENT_CERT"
4243
EnvVaultClientKey = "VAULT_CLIENT_KEY"
4344
EnvVaultClientTimeout = "VAULT_CLIENT_TIMEOUT"
45+
EnvVaultHeaders = "VAULT_HEADERS"
4446
EnvVaultSRVLookup = "VAULT_SRV_LOOKUP"
4547
EnvVaultSkipVerify = "VAULT_SKIP_VERIFY"
4648
EnvVaultNamespace = "VAULT_NAMESPACE"
@@ -665,6 +667,30 @@ func NewClient(c *Config) (*Client, error) {
665667
client.setNamespace(namespace)
666668
}
667669

670+
if envHeaders := os.Getenv(EnvVaultHeaders); envHeaders != "" {
671+
var result map[string]any
672+
err := json.Unmarshal([]byte(envHeaders), &result)
673+
if err != nil {
674+
return nil, fmt.Errorf("could not unmarshal environment-supplied headers")
675+
}
676+
var forbiddenHeaders []string
677+
for key, value := range result {
678+
if strings.HasPrefix(key, "X-Vault-") {
679+
forbiddenHeaders = append(forbiddenHeaders, key)
680+
continue
681+
}
682+
683+
value, ok := value.(string)
684+
if !ok {
685+
return nil, fmt.Errorf("environment-supplied headers include non-string values")
686+
}
687+
client.AddHeader(key, value)
688+
}
689+
if len(forbiddenHeaders) > 0 {
690+
return nil, fmt.Errorf("failed to setup Headers[%s]: Header starting by 'X-Vault-' are for internal usage only", strings.Join(forbiddenHeaders, ", "))
691+
}
692+
}
693+
668694
return client, nil
669695
}
670696

@@ -705,7 +731,7 @@ func (c *Client) SetAddress(addr string) error {
705731

706732
parsedAddr, err := c.config.ParseAddress(addr)
707733
if err != nil {
708-
return errwrap.Wrapf("failed to set address: {{err}}", err)
734+
return fmt.Errorf("failed to set address: %w", err)
709735
}
710736

711737
c.addr = parsedAddr

third_party/VENDOR-LICENSE/github.com/hashicorp/vault/api/lifetime_watcher.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"sync"
1111
"time"
1212

13-
"github.com/cenkalti/backoff/v3"
13+
"github.com/cenkalti/backoff/v4"
1414
)
1515

1616
var (

third_party/VENDOR-LICENSE/github.com/hashicorp/vault/api/request.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"bytes"
88
"encoding/json"
99
"io"
10-
"io/ioutil"
1110
"net/http"
1211
"net/url"
1312

@@ -77,13 +76,13 @@ func (r *Request) ToHTTP() (*http.Request, error) {
7776
// No body
7877

7978
case r.BodyBytes != nil:
80-
req.Request.Body = ioutil.NopCloser(bytes.NewReader(r.BodyBytes))
79+
req.Request.Body = io.NopCloser(bytes.NewReader(r.BodyBytes))
8180

8281
default:
8382
if c, ok := r.Body.(io.ReadCloser); ok {
8483
req.Request.Body = c
8584
} else {
86-
req.Request.Body = ioutil.NopCloser(r.Body)
85+
req.Request.Body = io.NopCloser(r.Body)
8786
}
8887
}
8988

third_party/VENDOR-LICENSE/github.com/hashicorp/vault/api/response.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"encoding/json"
99
"fmt"
1010
"io"
11-
"io/ioutil"
1211
"net/http"
1312
)
1413

@@ -44,7 +43,7 @@ func (r *Response) Error() error {
4443
}
4544

4645
r.Body.Close()
47-
r.Body = ioutil.NopCloser(bodyBuf)
46+
r.Body = io.NopCloser(bodyBuf)
4847
ns := r.Header.Get(NamespaceHeaderName)
4948

5049
// Build up the error object

third_party/VENDOR-LICENSE/github.com/hashicorp/vault/api/secret.go

+4
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ TOKEN_DONE:
159159
goto DONE
160160
}
161161

162+
if s.Data["identity_policies"] == nil {
163+
goto DONE
164+
}
165+
162166
sList, ok := s.Data["identity_policies"].([]string)
163167
if ok {
164168
identityPolicies = sList

third_party/VENDOR-LICENSE/github.com/hashicorp/vault/api/sudo_paths.go

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ var sudoPaths = map[string]*regexp.Regexp{
2828
"/sys/config/ui/headers": regexp.MustCompile(`^/sys/config/ui/headers/?$`),
2929
"/sys/config/ui/headers/{header}": regexp.MustCompile(`^/sys/config/ui/headers/.+$`),
3030
"/sys/internal/inspect/router/{tag}": regexp.MustCompile(`^/sys/internal/inspect/router/.+$`),
31+
"/sys/internal/counters/activity/export": regexp.MustCompile(`^/sys/internal/counters/activity/export$`),
3132
"/sys/leases": regexp.MustCompile(`^/sys/leases$`),
3233
// This entry is a bit wrong... sys/leases/lookup does NOT require sudo. But sys/leases/lookup/ with a trailing
3334
// slash DOES require sudo. But the part of the Vault CLI that uses this logic doesn't pass operation-appropriate

third_party/VENDOR-LICENSE/github.com/hashicorp/vault/api/sys_raft.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ func (c *Sys) RaftSnapshotWithContext(ctx context.Context, snapWriter io.Writer)
264264
continue
265265
}
266266
var b []byte
267-
b, err = ioutil.ReadAll(t)
267+
b, err = io.ReadAll(t)
268268
if err != nil || len(b) == 0 {
269269
return
270270
}

0 commit comments

Comments
 (0)