diff --git a/CHANGELOG.md b/CHANGELOG.md index 566320fefa0..0ae23e78b0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,7 @@ * [BUGFIX] Index page now uses configured HTTP path prefix when creating links. #3126 * [BUGFIX] Index page no longer shows links that are not valid for running Cortex instance. #3133 * [BUGFIX] Configs: prevent validation of templates to fail when using template functions. #3157 +* [BUGFIX] Configuring the S3 URL with an `@` but without username and password doesn't enable the AWS static credentials anymore. #3170 ## 1.3.0 / 2020-08-21 diff --git a/go.mod b/go.mod index 72d324a3aea..a35f8e03922 100644 --- a/go.mod +++ b/go.mod @@ -55,7 +55,7 @@ require ( github.com/stretchr/testify v1.6.1 github.com/thanos-io/thanos v0.13.1-0.20200807203500-9b578afb4763 github.com/uber/jaeger-client-go v2.25.0+incompatible - github.com/weaveworks/common v0.0.0-20200820123129-280614068c5e + github.com/weaveworks/common v0.0.0-20200914083218-61ffdd448099 github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da // indirect go.etcd.io/bbolt v1.3.5-0.20200615073812-232d8fc87f50 go.etcd.io/etcd v0.5.0-alpha.5.0.20200520232829-54ba9589114f diff --git a/go.sum b/go.sum index f67f004d4cc..e83ecc56bb4 100644 --- a/go.sum +++ b/go.sum @@ -1100,8 +1100,8 @@ github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtX github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw= github.com/weaveworks/common v0.0.0-20200206153930-760e36ae819a/go.mod h1:6enWAqfQBFrE8X/XdJwZr8IKgh1chStuFR0mjU/UOUw= github.com/weaveworks/common v0.0.0-20200625145055-4b1847531bc9/go.mod h1:c98fKi5B9u8OsKGiWHLRKus6ToQ1Tubeow44ECO1uxY= -github.com/weaveworks/common v0.0.0-20200820123129-280614068c5e h1:t/as1iFw9iI6s0q9ESR2tTn2qGhI42LjBkPuQLuLzM8= -github.com/weaveworks/common v0.0.0-20200820123129-280614068c5e/go.mod h1:hz10LOsAdzC3K/iXaKoFxOKTDRgxJl+BTGX1GY+TzO4= +github.com/weaveworks/common v0.0.0-20200914083218-61ffdd448099 h1:MS5M2antM8wzMUqVxIfAi+yb6yjXvDINRFvLnmNXeIw= +github.com/weaveworks/common v0.0.0-20200914083218-61ffdd448099/go.mod h1:hz10LOsAdzC3K/iXaKoFxOKTDRgxJl+BTGX1GY+TzO4= github.com/weaveworks/promrus v1.2.0 h1:jOLf6pe6/vss4qGHjXmGz4oDJQA+AOCqEL3FvvZGz7M= github.com/weaveworks/promrus v1.2.0/go.mod h1:SaE82+OJ91yqjrE1rsvBWVzNZKcHYFtMUyS1+Ogs/KA= github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= diff --git a/vendor/github.com/weaveworks/common/aws/config.go b/vendor/github.com/weaveworks/common/aws/config.go index 8937e749ef5..3d92b9861f7 100644 --- a/vendor/github.com/weaveworks/common/aws/config.go +++ b/vendor/github.com/weaveworks/common/aws/config.go @@ -40,9 +40,13 @@ func ConfigFromURL(awsURL *url.URL) (*aws.Config, error) { }) if awsURL.User != nil { + username := awsURL.User.Username() password, _ := awsURL.User.Password() - creds := credentials.NewStaticCredentials(awsURL.User.Username(), password, "") - config = config.WithCredentials(creds) + + // We request at least the username or password being set to enable the static credentials. + if username != "" || password != "" { + config = config.WithCredentials(credentials.NewStaticCredentials(username, password, "")) + } } if strings.Contains(awsURL.Host, ".") { diff --git a/vendor/github.com/weaveworks/common/httpgrpc/README.md b/vendor/github.com/weaveworks/common/httpgrpc/README.md index 95c74535e51..50ce9698085 100644 --- a/vendor/github.com/weaveworks/common/httpgrpc/README.md +++ b/vendor/github.com/weaveworks/common/httpgrpc/README.md @@ -1,6 +1,6 @@ **What?** Embedding HTTP requests and responses into a gRPC service; a service and client to translate back and forth between the two, so you can use them with your faviourite mux. -**Why?** Get all the goodness of protobuf encoding, HTTP/2, snappy, load balancing, persistent connection and native Kuberneretes load balancing with ~none of the effort. +**Why?** Get all the goodness of protobuf encoding, HTTP/2, snappy, load balancing, persistent connection and native Kubernetes load balancing with ~none of the effort. To rebuild generated protobuf code, run: diff --git a/vendor/github.com/weaveworks/common/server/server.go b/vendor/github.com/weaveworks/common/server/server.go index ae04022c691..a4bedb80a91 100644 --- a/vendor/github.com/weaveworks/common/server/server.go +++ b/vendor/github.com/weaveworks/common/server/server.go @@ -62,10 +62,12 @@ type Config struct { HTTPServerWriteTimeout time.Duration `yaml:"http_server_write_timeout"` HTTPServerIdleTimeout time.Duration `yaml:"http_server_idle_timeout"` - GRPCOptions []grpc.ServerOption `yaml:"-"` - GRPCMiddleware []grpc.UnaryServerInterceptor `yaml:"-"` - GRPCStreamMiddleware []grpc.StreamServerInterceptor `yaml:"-"` - HTTPMiddleware []middleware.Interface `yaml:"-"` + GRPCOptions []grpc.ServerOption `yaml:"-"` + GRPCMiddleware []grpc.UnaryServerInterceptor `yaml:"-"` + GRPCStreamMiddleware []grpc.StreamServerInterceptor `yaml:"-"` + HTTPMiddleware []middleware.Interface `yaml:"-"` + Router *mux.Router `yaml:"-"` + DoNotAddDefaultHTTPMiddleware bool `yaml:"-"` GPRCServerMaxRecvMsgSize int `yaml:"grpc_server_max_recv_msg_size"` GRPCServerMaxSendMsgSize int `yaml:"grpc_server_max_send_msg_size"` @@ -270,7 +272,12 @@ func New(cfg Config) (*Server, error) { grpcServer := grpc.NewServer(grpcOptions...) // Setup HTTP server - router := mux.NewRouter() + var router *mux.Router + if cfg.Router != nil { + router = cfg.Router + } else { + router = mux.NewRouter() + } if cfg.PathPrefix != "" { // Expect metrics and pprof handlers to be prefixed with server's path prefix. // e.g. /loki/metrics or /loki/debug/pprof @@ -279,6 +286,7 @@ func New(cfg Config) (*Server, error) { if cfg.RegisterInstrumentation { RegisterInstrumentation(router) } + var sourceIPs *middleware.SourceIPExtractor if cfg.LogSourceIPs { sourceIPs, err = middleware.NewSourceIPs(cfg.LogSourceIPsHeader, cfg.LogSourceIPsRegex) @@ -286,7 +294,8 @@ func New(cfg Config) (*Server, error) { return nil, fmt.Errorf("error setting up source IP extraction: %v", err) } } - httpMiddleware := []middleware.Interface{ + + defaultHTTPMiddleware := []middleware.Interface{ middleware.Tracer{ RouteMatcher: router, SourceIPs: sourceIPs, @@ -303,8 +312,13 @@ func New(cfg Config) (*Server, error) { InflightRequests: inflightRequests, }, } + httpMiddleware := []middleware.Interface{} + if cfg.DoNotAddDefaultHTTPMiddleware { + httpMiddleware = cfg.HTTPMiddleware + } else { + httpMiddleware = append(defaultHTTPMiddleware, cfg.HTTPMiddleware...) + } - httpMiddleware = append(httpMiddleware, cfg.HTTPMiddleware...) httpServer := &http.Server{ ReadTimeout: cfg.HTTPServerReadTimeout, WriteTimeout: cfg.HTTPServerWriteTimeout, diff --git a/vendor/modules.txt b/vendor/modules.txt index 049e8ee0cfd..4ac163caccf 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -718,7 +718,7 @@ github.com/uber/jaeger-client-go/utils # github.com/uber/jaeger-lib v2.2.0+incompatible github.com/uber/jaeger-lib/metrics github.com/uber/jaeger-lib/metrics/prometheus -# github.com/weaveworks/common v0.0.0-20200820123129-280614068c5e +# github.com/weaveworks/common v0.0.0-20200914083218-61ffdd448099 ## explicit github.com/weaveworks/common/aws github.com/weaveworks/common/errors