Skip to content
This repository was archived by the owner on Mar 15, 2024. It is now read-only.

Commit 5399891

Browse files
author
Michael Weber
committed
Upgrade vault to v1.8.1 and runc to 1.0.0-rc95
Also: go 1.16.6 Fixes: * CVE-2020-16250 * CVE-2020-7220 * CVE-2021-32923 * GHSA-c3xm-pvg7-gh7r
1 parent 4aa7e80 commit 5399891

File tree

18 files changed

+1634
-212
lines changed

18 files changed

+1634
-212
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
build:
1111
working_directory: /go/workdir/src/github.com/splunk/vault-plugin-splunk
1212
docker:
13-
- image: circleci/golang:1.13.4
13+
- image: circleci/golang:1.16.6
1414
<<: *defaultenv
1515
- image: splunk/splunk:latest
1616
user: root

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
GOLANGCI_LINT_ARGS := --enable=gosec --enable=dupl
1+
GOLANGCI_LINT_ARGS := -v --enable=gosec --enable=dupl --timeout 5m
22
TESTREPORT := test-results.xml
33

44
# XXX BUG(mweber) "go env GOBIN" is empty?
@@ -36,7 +36,7 @@ lint: dep
3636

3737
.PHONY: dep
3838
dep:
39-
./scripts/golangci-lint.sh -b $(GOBIN) v1.20.0
39+
./scripts/golangci-lint.sh -b $(GOBIN) v1.42.0
4040

4141
.PHONY: clean
4242
clean:

backend.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"strings"
66
"sync"
77

8-
"github.com/hashicorp/vault/logical"
9-
"github.com/hashicorp/vault/logical/framework"
8+
"github.com/hashicorp/vault/sdk/framework"
9+
"github.com/hashicorp/vault/sdk/logical"
1010
"github.com/splunk/vault-plugin-splunk/clients/splunk"
1111
)
1212

backend_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"testing"
77
"time"
88

9-
"github.com/hashicorp/vault/logical"
10-
logicaltest "github.com/hashicorp/vault/logical/testing"
9+
logicaltest "github.com/hashicorp/vault/helper/testhelpers/logical"
10+
"github.com/hashicorp/vault/sdk/logical"
1111
"github.com/mitchellh/mapstructure"
1212
"gotest.tools/assert"
1313

clients/splunk/testing.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"testing"
1212
"time"
1313

14-
"github.com/hashicorp/errwrap"
1514
"github.com/hashicorp/go-uuid"
1615
"github.com/ory/dockertest"
1716
"golang.org/x/oauth2"
@@ -137,13 +136,13 @@ func NewTestSplunkService() (cleanup func(), conn *API, err error) {
137136
}
138137
password, err := uuid.GenerateUUID()
139138
if err != nil {
140-
err = errwrap.Wrapf("error generating password: {{err}}", err)
139+
err = fmt.Errorf("error generating password: %w", err)
141140
return
142141
}
143142

144143
pool, err := dockertest.NewPool("")
145144
if err != nil {
146-
err = errwrap.Wrapf("Failed to connect to docker: {{err}}", err)
145+
err = fmt.Errorf("Failed to connect to docker: %w", err)
147146
return
148147
}
149148

@@ -153,7 +152,7 @@ func NewTestSplunkService() (cleanup func(), conn *API, err error) {
153152
}
154153
resource, err := pool.Run(testDefaultSplunkContainer, testDefaultSplunkVersion, env)
155154
if err != nil {
156-
err = errwrap.Wrapf("failed to start local container: {{err}}", err)
155+
err = fmt.Errorf("failed to start local container: %w", err)
157156
return
158157
}
159158

@@ -173,7 +172,7 @@ func NewTestSplunkService() (cleanup func(), conn *API, err error) {
173172
return err
174173
})
175174
if err != nil {
176-
err = errwrap.Wrapf("Could not connect to Splunk container: {{err}}", err)
175+
err = fmt.Errorf("Could not connect to Splunk container: %w", err)
177176
return
178177
}
179178
return
@@ -196,7 +195,7 @@ func NewTestSplunkServiceWithTempAdmin() (cleanup func(), conn *API, err error)
196195
Roles: []string{"admin"},
197196
})
198197
if err != nil {
199-
err = errwrap.Wrapf(fmt.Sprintf("unable to create test user %q: {{err}}", testUser), err)
198+
err = fmt.Errorf("unable to create test user %q: %w", testUser, err)
200199
return
201200
}
202201

cmd/vault-plugin-splunk/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"os"
66

77
"github.com/hashicorp/go-hclog"
8-
"github.com/hashicorp/vault/helper/pluginutil"
9-
"github.com/hashicorp/vault/logical/plugin"
8+
"github.com/hashicorp/vault/api"
9+
"github.com/hashicorp/vault/sdk/plugin"
1010

1111
splunk "github.com/splunk/vault-plugin-splunk"
1212
)
@@ -20,7 +20,7 @@ var (
2020
)
2121

2222
func main() {
23-
apiClientMeta := &pluginutil.APIClientMeta{}
23+
apiClientMeta := &api.PluginAPIClientMeta{}
2424
flags := apiClientMeta.FlagSet()
2525
printVersion := flags.Bool("version", false, "Prints version")
2626

@@ -44,7 +44,7 @@ func main() {
4444
}
4545

4646
tlsConfig := apiClientMeta.GetTLSConfig()
47-
tlsProviderFunc := pluginutil.VaultPluginTLSProvider(tlsConfig)
47+
tlsProviderFunc := api.VaultPluginTLSProvider(tlsConfig)
4848

4949
err := plugin.Serve(&plugin.ServeOpts{
5050
BackendFactoryFunc: splunk.Factory,

conn.go

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@ import (
99
"time"
1010

1111
"github.com/fatih/structs"
12-
"github.com/hashicorp/errwrap"
1312
uuid "github.com/hashicorp/go-uuid"
14-
"github.com/hashicorp/vault/helper/certutil"
15-
"github.com/hashicorp/vault/helper/tlsutil"
16-
"github.com/hashicorp/vault/helper/useragent"
17-
"github.com/hashicorp/vault/logical"
18-
"github.com/hashicorp/vault/logical/framework"
13+
"github.com/hashicorp/vault/sdk/framework"
14+
"github.com/hashicorp/vault/sdk/helper/certutil"
15+
"github.com/hashicorp/vault/sdk/helper/tlsutil"
16+
"github.com/hashicorp/vault/sdk/helper/useragent"
17+
"github.com/hashicorp/vault/sdk/logical"
1918
"golang.org/x/oauth2"
2019

2120
"github.com/splunk/vault-plugin-splunk/clients/splunk"
@@ -72,7 +71,7 @@ func (config *splunkConfig) store(ctx context.Context, s logical.Storage, name s
7271
var walID string
7372
walID, err = framework.PutWAL(ctx, s, walTypeConn, &walConnection{oldConfigID})
7473
if err != nil {
75-
return errwrap.Wrapf("unable to create WAL for deleting cached connection: {{err}}", err)
74+
return fmt.Errorf("unable to create WAL for deleting cached connection: %w", err)
7675
}
7776

7877
defer func() {
@@ -87,16 +86,16 @@ func (config *splunkConfig) store(ctx context.Context, s logical.Storage, name s
8786

8887
config.ID, err = uuid.GenerateUUID()
8988
if err != nil {
90-
return errwrap.Wrapf("error generating new configuration ID: {{err}}", err)
89+
return fmt.Errorf("error generating new configuration ID: %w", err)
9190
}
9291

9392
var newEntry *logical.StorageEntry
9493
newEntry, err = logical.StorageEntryJSON(fmt.Sprintf("config/%s", name), config)
9594
if err != nil {
96-
return errwrap.Wrapf(fmt.Sprintf("error writing config/%s JSON: {{err}}", name), err)
95+
return fmt.Errorf("error writing config/%s JSON: %w", name, err)
9796
}
9897
if err = s.Put(ctx, newEntry); err != nil {
99-
return errwrap.Wrapf(fmt.Sprintf("error saving new config/%s: {{err}}", name), err)
98+
return fmt.Errorf("error saving new config/%s: %w", name, err)
10099
}
101100

102101
// if config.Verify {
@@ -113,7 +112,7 @@ func connectionConfigExists(ctx context.Context, s logical.Storage, name string)
113112

114113
entry, err := s.Get(ctx, fmt.Sprintf("config/%s", name))
115114
if err != nil {
116-
return false, errwrap.Wrapf("error reading connection configuration: {{err}}", err)
115+
return false, fmt.Errorf("error reading connection configuration: %w", err)
117116
}
118117
return entry != nil, nil
119118
}
@@ -124,7 +123,7 @@ func connectionConfigLoad(ctx context.Context, s logical.Storage, name string) (
124123
}
125124
entry, err := s.Get(ctx, fmt.Sprintf("config/%s", name))
126125
if err != nil {
127-
return nil, errwrap.Wrapf("error reading connection configuration: {{err}}", err)
126+
return nil, fmt.Errorf("error reading connection configuration: %w", err)
128127
}
129128
if entry == nil {
130129
return nil, fmt.Errorf("connection configuration not found: %q", name)
@@ -180,15 +179,17 @@ func (config *splunkConfig) tlsConfig() (tlsConfig *tls.Config, err error) {
180179
}
181180
parsedCertBundle, err := certBundle.ToParsedCertBundle()
182181
if err != nil {
183-
return nil, errwrap.Wrapf("failed to parse certificate bundle: {{err}}", err)
182+
return nil, fmt.Errorf("failed to parse certificate bundle: %w", err)
184183
}
185184

186185
tlsConfig, err = parsedCertBundle.GetTLSConfig(certutil.TLSClient)
187186
if err != nil || tlsConfig == nil {
188-
return nil, errwrap.Wrapf(fmt.Sprintf("failed to get TLS configuration: tlsConfig: %#v; {{err}}", tlsConfig), err)
187+
return nil, fmt.Errorf("failed to get TLS configuration: tlsConfig: %#v; %w", tlsConfig, err)
189188
}
190189
} else {
191-
tlsConfig = &tls.Config{}
190+
tlsConfig = &tls.Config{
191+
MinVersion: tls.VersionTLS12, // gosec G402
192+
}
192193
}
193194

194195
tlsConfig.InsecureSkipVerify = config.InsecureTLS

go.mod

Lines changed: 15 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,26 @@
11
module github.com/splunk/vault-plugin-splunk
22

3-
go 1.12
3+
go 1.16
44

55
require (
6-
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect
7-
github.com/Microsoft/go-winio v0.4.13 // indirect
8-
github.com/NYTimes/gziphandler v1.1.1 // indirect
9-
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
10-
github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878 // indirect
11-
github.com/armon/go-radix v1.0.0 // indirect
12-
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
13-
github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc // indirect
146
github.com/dghubble/sling v1.3.0
15-
github.com/docker/go-connections v0.4.0 // indirect
16-
github.com/docker/go-units v0.4.0 // indirect
17-
github.com/elazarl/go-bindata-assetfs v1.0.0 // indirect
7+
github.com/fatih/color v1.12.0 // indirect
188
github.com/fatih/structs v1.1.0
19-
github.com/go-sql-driver/mysql v1.4.1 // indirect
20-
github.com/go-test/deep v1.0.5 // indirect
21-
github.com/golang/snappy v0.0.1 // indirect
229
github.com/google/go-querystring v1.0.0
23-
github.com/gotestyourself/gotestyourself v2.2.0+incompatible // indirect
24-
github.com/hashicorp/errwrap v1.0.0
25-
github.com/hashicorp/go-cleanhttp v0.5.1 // indirect
26-
github.com/hashicorp/go-hclog v0.9.2
27-
github.com/hashicorp/go-memdb v1.0.3 // indirect
28-
github.com/hashicorp/go-plugin v1.0.1 // indirect
29-
github.com/hashicorp/go-retryablehttp v0.5.4 // indirect
30-
github.com/hashicorp/go-rootcerts v1.0.1 // indirect
31-
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
32-
github.com/hashicorp/go-uuid v1.0.1
33-
github.com/hashicorp/go-version v1.2.0 // indirect
34-
github.com/hashicorp/golang-lru v0.5.3 // indirect
35-
github.com/hashicorp/hcl v1.0.0 // indirect
36-
github.com/hashicorp/vault v1.1.4
37-
github.com/jefferai/jsonx v1.0.1 // indirect
38-
github.com/keybase/go-crypto v0.0.0-20190416182011-b785b22cc757 // indirect
39-
github.com/lib/pq v1.2.0 // indirect
40-
github.com/mitchellh/copystructure v1.0.0 // indirect
41-
github.com/mitchellh/go-testing-interface v1.0.0 // indirect
42-
github.com/mitchellh/mapstructure v1.1.2
43-
github.com/mitchellh/reflectwalk v1.0.1 // indirect
10+
github.com/hashicorp/go-hclog v0.16.1
11+
github.com/hashicorp/go-uuid v1.0.2
12+
github.com/hashicorp/vault v1.8.1
13+
github.com/hashicorp/vault/api v1.1.2-0.20210713235431-1fc8af4c041f
14+
github.com/hashicorp/vault/sdk v0.2.2-0.20210713235431-1fc8af4c041f
15+
github.com/mattn/go-isatty v0.0.13 // indirect
16+
github.com/mitchellh/mapstructure v1.3.3
4417
github.com/mr-tron/base58 v1.1.3
45-
github.com/opencontainers/go-digest v1.0.0-rc1 // indirect
46-
github.com/opencontainers/image-spec v1.0.1 // indirect
47-
github.com/opencontainers/runc v0.1.1 // indirect
48-
github.com/ory/dockertest v3.3.4+incompatible
49-
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
50-
github.com/pierrec/lz4 v2.2.6+incompatible // indirect
51-
github.com/prometheus/client_golang v1.1.0 // indirect
52-
github.com/ryanuber/go-glob v1.0.0 // indirect
18+
github.com/opencontainers/runc v1.0.0-rc95 // indirect
19+
github.com/ory/dockertest v3.3.5+incompatible
5320
github.com/sethvargo/go-password v0.1.3
54-
github.com/sirupsen/logrus v1.4.2 // indirect
55-
golang.org/x/net v0.0.0-20190620200207-3b0461eec859 // indirect
56-
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
57-
golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa // indirect
58-
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect
59-
google.golang.org/appengine v1.6.0 // indirect
60-
google.golang.org/grpc v1.22.1 // indirect
61-
gopkg.in/square/go-jose.v2 v2.3.1 // indirect
21+
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
22+
golang.org/x/sys v0.0.0-20210818153620-00dd8d7831e7 // indirect
23+
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect
24+
golang.org/x/tools v0.1.5 // indirect
6225
gotest.tools v2.2.0+incompatible
6326
)

0 commit comments

Comments
 (0)