From 2d859d83ea95c65e05bbd2fe8896d0844f510670 Mon Sep 17 00:00:00 2001 From: Jim Kalafut Date: Tue, 7 Jan 2020 14:14:45 -0800 Subject: [PATCH] Update vendoring (#8111) --- .../vault/sdk/database/helper/connutil/sql.go | 2 +- .../hashicorp/vault/sdk/framework/backend.go | 16 +++++++- .../hashicorp/vault/sdk/framework/path.go | 38 ++++++++++++------- .../vault/sdk/plugin/pb/backend.pb.go | 4 +- .../vault/sdk/plugin/pb/backend.proto | 2 +- 5 files changed, 44 insertions(+), 18 deletions(-) diff --git a/vendor/github.com/hashicorp/vault/sdk/database/helper/connutil/sql.go b/vendor/github.com/hashicorp/vault/sdk/database/helper/connutil/sql.go index e5e078a71..796df8b16 100644 --- a/vendor/github.com/hashicorp/vault/sdk/database/helper/connutil/sql.go +++ b/vendor/github.com/hashicorp/vault/sdk/database/helper/connutil/sql.go @@ -58,7 +58,7 @@ func (c *SQLConnectionProducer) Init(ctx context.Context, conf map[string]interf // Don't escape special characters for MySQL password password := c.Password if c.Type != "mysql" { - //password = url.PathEscape(c.Password) + password = url.PathEscape(c.Password) } // QueryHelper doesn't do any SQL escaping, but if it starts to do so diff --git a/vendor/github.com/hashicorp/vault/sdk/framework/backend.go b/vendor/github.com/hashicorp/vault/sdk/framework/backend.go index a4e9f2de3..bfcbe4e9d 100644 --- a/vendor/github.com/hashicorp/vault/sdk/framework/backend.go +++ b/vendor/github.com/hashicorp/vault/sdk/framework/backend.go @@ -15,7 +15,8 @@ import ( "github.com/hashicorp/errwrap" log "github.com/hashicorp/go-hclog" - multierror "github.com/hashicorp/go-multierror" + "github.com/hashicorp/go-multierror" + "github.com/hashicorp/vault/sdk/helper/consts" "github.com/hashicorp/vault/sdk/helper/entropy" "github.com/hashicorp/vault/sdk/helper/errutil" "github.com/hashicorp/vault/sdk/helper/license" @@ -225,6 +226,19 @@ func (b *Backend) HandleRequest(ctx context.Context, req *logical.Request) (*log if path.Operations != nil { if op, ok := path.Operations[req.Operation]; ok { + + // Check whether this operation should be forwarded + replState := b.System().ReplicationState() + props := op.Properties() + + if props.ForwardPerformanceStandby && replState.HasState(consts.ReplicationPerformanceStandby) { + return nil, logical.ErrReadOnly + } + + if props.ForwardPerformanceSecondary && !b.System().LocalMount() && replState.HasState(consts.ReplicationPerformanceSecondary) { + return nil, logical.ErrReadOnly + } + callback = op.Handler() } } else { diff --git a/vendor/github.com/hashicorp/vault/sdk/framework/path.go b/vendor/github.com/hashicorp/vault/sdk/framework/path.go index d6fc6e935..8f5dd5bee 100644 --- a/vendor/github.com/hashicorp/vault/sdk/framework/path.go +++ b/vendor/github.com/hashicorp/vault/sdk/framework/path.go @@ -153,6 +153,14 @@ type OperationProperties struct { // Deprecated indicates that this operation should be avoided. Deprecated bool + // ForwardPerformanceStandby indicates that this path should not be processed + // on a performance standby node, and should be forwarded to the active node instead. + ForwardPerformanceStandby bool + + // ForwardPerformanceSecondary indicates that this path should not be processed + // on a performance secondary node, and should be forwarded to the active node instead. + ForwardPerformanceSecondary bool + // DisplayAttrs provides hints for UI and documentation generators. They // will be included in OpenAPI output if set. DisplayAttrs *DisplayAttributes @@ -206,13 +214,15 @@ type Response struct { // PathOperation is a concrete implementation of OperationHandler. type PathOperation struct { - Callback OperationFunc - Summary string - Description string - Examples []RequestExample - Responses map[int][]Response - Unpublished bool - Deprecated bool + Callback OperationFunc + Summary string + Description string + Examples []RequestExample + Responses map[int][]Response + Unpublished bool + Deprecated bool + ForwardPerformanceSecondary bool + ForwardPerformanceStandby bool } func (p *PathOperation) Handler() OperationFunc { @@ -221,12 +231,14 @@ func (p *PathOperation) Handler() OperationFunc { func (p *PathOperation) Properties() OperationProperties { return OperationProperties{ - Summary: strings.TrimSpace(p.Summary), - Description: strings.TrimSpace(p.Description), - Responses: p.Responses, - Examples: p.Examples, - Unpublished: p.Unpublished, - Deprecated: p.Deprecated, + Summary: strings.TrimSpace(p.Summary), + Description: strings.TrimSpace(p.Description), + Responses: p.Responses, + Examples: p.Examples, + Unpublished: p.Unpublished, + Deprecated: p.Deprecated, + ForwardPerformanceSecondary: p.ForwardPerformanceSecondary, + ForwardPerformanceStandby: p.ForwardPerformanceStandby, } } diff --git a/vendor/github.com/hashicorp/vault/sdk/plugin/pb/backend.pb.go b/vendor/github.com/hashicorp/vault/sdk/plugin/pb/backend.pb.go index 8c7f57c10..efd386b8e 100644 --- a/vendor/github.com/hashicorp/vault/sdk/plugin/pb/backend.pb.go +++ b/vendor/github.com/hashicorp/vault/sdk/plugin/pb/backend.pb.go @@ -3524,7 +3524,7 @@ type SystemViewClient interface { EntityInfo(ctx context.Context, in *EntityInfoArgs, opts ...grpc.CallOption) (*EntityInfoReply, error) // PluginEnv returns Vault environment information used by plugins PluginEnv(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*PluginEnvReply, error) - // GroupsForEntity returns the group membersship information for the given + // GroupsForEntity returns the group membership information for the given // entity id GroupsForEntity(ctx context.Context, in *EntityInfoArgs, opts ...grpc.CallOption) (*GroupsForEntityReply, error) } @@ -3671,7 +3671,7 @@ type SystemViewServer interface { EntityInfo(context.Context, *EntityInfoArgs) (*EntityInfoReply, error) // PluginEnv returns Vault environment information used by plugins PluginEnv(context.Context, *Empty) (*PluginEnvReply, error) - // GroupsForEntity returns the group membersship information for the given + // GroupsForEntity returns the group membership information for the given // entity id GroupsForEntity(context.Context, *EntityInfoArgs) (*GroupsForEntityReply, error) } diff --git a/vendor/github.com/hashicorp/vault/sdk/plugin/pb/backend.proto b/vendor/github.com/hashicorp/vault/sdk/plugin/pb/backend.proto index 9536fde6c..7b910ea0f 100644 --- a/vendor/github.com/hashicorp/vault/sdk/plugin/pb/backend.proto +++ b/vendor/github.com/hashicorp/vault/sdk/plugin/pb/backend.proto @@ -600,7 +600,7 @@ service SystemView { // PluginEnv returns Vault environment information used by plugins rpc PluginEnv(Empty) returns (PluginEnvReply); - // GroupsForEntity returns the group membersship information for the given + // GroupsForEntity returns the group membership information for the given // entity id rpc GroupsForEntity(EntityInfoArgs) returns (GroupsForEntityReply); }