@@ -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
0 commit comments