Update vendoring (#8111)

This commit is contained in:
Jim Kalafut 2020-01-07 14:14:45 -08:00 committed by GitHub
parent fb4edc129e
commit 2d859d83ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 18 deletions

View File

@ -58,7 +58,7 @@ func (c *SQLConnectionProducer) Init(ctx context.Context, conf map[string]interf
// Don't escape special characters for MySQL password // Don't escape special characters for MySQL password
password := c.Password password := c.Password
if c.Type != "mysql" { 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 // QueryHelper doesn't do any SQL escaping, but if it starts to do so

View File

@ -15,7 +15,8 @@ import (
"github.com/hashicorp/errwrap" "github.com/hashicorp/errwrap"
log "github.com/hashicorp/go-hclog" 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/entropy"
"github.com/hashicorp/vault/sdk/helper/errutil" "github.com/hashicorp/vault/sdk/helper/errutil"
"github.com/hashicorp/vault/sdk/helper/license" "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 path.Operations != nil {
if op, ok := path.Operations[req.Operation]; ok { 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() callback = op.Handler()
} }
} else { } else {

View File

@ -153,6 +153,14 @@ type OperationProperties struct {
// Deprecated indicates that this operation should be avoided. // Deprecated indicates that this operation should be avoided.
Deprecated bool 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 // DisplayAttrs provides hints for UI and documentation generators. They
// will be included in OpenAPI output if set. // will be included in OpenAPI output if set.
DisplayAttrs *DisplayAttributes DisplayAttrs *DisplayAttributes
@ -206,13 +214,15 @@ type Response struct {
// PathOperation is a concrete implementation of OperationHandler. // PathOperation is a concrete implementation of OperationHandler.
type PathOperation struct { type PathOperation struct {
Callback OperationFunc Callback OperationFunc
Summary string Summary string
Description string Description string
Examples []RequestExample Examples []RequestExample
Responses map[int][]Response Responses map[int][]Response
Unpublished bool Unpublished bool
Deprecated bool Deprecated bool
ForwardPerformanceSecondary bool
ForwardPerformanceStandby bool
} }
func (p *PathOperation) Handler() OperationFunc { func (p *PathOperation) Handler() OperationFunc {
@ -221,12 +231,14 @@ func (p *PathOperation) Handler() OperationFunc {
func (p *PathOperation) Properties() OperationProperties { func (p *PathOperation) Properties() OperationProperties {
return OperationProperties{ return OperationProperties{
Summary: strings.TrimSpace(p.Summary), Summary: strings.TrimSpace(p.Summary),
Description: strings.TrimSpace(p.Description), Description: strings.TrimSpace(p.Description),
Responses: p.Responses, Responses: p.Responses,
Examples: p.Examples, Examples: p.Examples,
Unpublished: p.Unpublished, Unpublished: p.Unpublished,
Deprecated: p.Deprecated, Deprecated: p.Deprecated,
ForwardPerformanceSecondary: p.ForwardPerformanceSecondary,
ForwardPerformanceStandby: p.ForwardPerformanceStandby,
} }
} }

View File

@ -3524,7 +3524,7 @@ type SystemViewClient interface {
EntityInfo(ctx context.Context, in *EntityInfoArgs, opts ...grpc.CallOption) (*EntityInfoReply, error) EntityInfo(ctx context.Context, in *EntityInfoArgs, opts ...grpc.CallOption) (*EntityInfoReply, error)
// PluginEnv returns Vault environment information used by plugins // PluginEnv returns Vault environment information used by plugins
PluginEnv(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*PluginEnvReply, error) 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 // entity id
GroupsForEntity(ctx context.Context, in *EntityInfoArgs, opts ...grpc.CallOption) (*GroupsForEntityReply, error) GroupsForEntity(ctx context.Context, in *EntityInfoArgs, opts ...grpc.CallOption) (*GroupsForEntityReply, error)
} }
@ -3671,7 +3671,7 @@ type SystemViewServer interface {
EntityInfo(context.Context, *EntityInfoArgs) (*EntityInfoReply, error) EntityInfo(context.Context, *EntityInfoArgs) (*EntityInfoReply, error)
// PluginEnv returns Vault environment information used by plugins // PluginEnv returns Vault environment information used by plugins
PluginEnv(context.Context, *Empty) (*PluginEnvReply, error) 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 // entity id
GroupsForEntity(context.Context, *EntityInfoArgs) (*GroupsForEntityReply, error) GroupsForEntity(context.Context, *EntityInfoArgs) (*GroupsForEntityReply, error)
} }

View File

@ -600,7 +600,7 @@ service SystemView {
// PluginEnv returns Vault environment information used by plugins // PluginEnv returns Vault environment information used by plugins
rpc PluginEnv(Empty) returns (PluginEnvReply); 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 // entity id
rpc GroupsForEntity(EntityInfoArgs) returns (GroupsForEntityReply); rpc GroupsForEntity(EntityInfoArgs) returns (GroupsForEntityReply);
} }