From d1f7e21e1e7a389af8fc2d536a492a46ecfe5d06 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Jun 2025 08:20:05 +0000 Subject: [PATCH] build(deps): bump github.com/go-chi/chi/v5 Bumps [github.com/go-chi/chi/v5](https://github.com/go-chi/chi) from 5.2.1 to 5.2.2. - [Release notes](https://github.com/go-chi/chi/releases) - [Changelog](https://github.com/go-chi/chi/blob/master/CHANGELOG.md) - [Commits](https://github.com/go-chi/chi/compare/v5.2.1...v5.2.2) --- updated-dependencies: - dependency-name: github.com/go-chi/chi/v5 dependency-version: 5.2.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- assets/credhub-service-broker/go.mod | 2 +- assets/credhub-service-broker/go.sum | 4 ++-- .../vendor/github.com/go-chi/chi/v5/README.md | 6 +++-- .../vendor/github.com/go-chi/chi/v5/chi.go | 3 +-- .../go-chi/chi/v5/middleware/compress.go | 24 +++++++------------ .../chi/v5/middleware/content_charset.go | 9 ++++--- .../go-chi/chi/v5/middleware/content_type.go | 4 ++-- .../go-chi/chi/v5/middleware/profiler.go | 3 +++ .../go-chi/chi/v5/middleware/realip.go | 6 +---- .../go-chi/chi/v5/middleware/route_headers.go | 8 +------ .../go-chi/chi/v5/middleware/strip.go | 10 ++++---- .../go-chi/chi/v5/middleware/throttle.go | 2 +- .../go-chi/chi/v5/middleware/wrap_writer.go | 7 +++--- .../vendor/github.com/go-chi/chi/v5/mux.go | 10 ++++---- .../github.com/go-chi/chi/v5/path_value.go | 5 ++-- .../go-chi/chi/v5/path_value_fallback.go | 4 ++-- .../vendor/github.com/go-chi/chi/v5/tree.go | 6 ++--- .../credhub-service-broker/vendor/modules.txt | 2 +- 18 files changed, 49 insertions(+), 66 deletions(-) diff --git a/assets/credhub-service-broker/go.mod b/assets/credhub-service-broker/go.mod index 49c7c3955..23d11bf52 100644 --- a/assets/credhub-service-broker/go.mod +++ b/assets/credhub-service-broker/go.mod @@ -6,7 +6,7 @@ toolchain go1.24.1 require ( code.cloudfoundry.org/credhub-cli v0.0.0-20230320130818-a7d5420b283b - github.com/go-chi/chi/v5 v5.2.1 + github.com/go-chi/chi/v5 v5.2.2 github.com/satori/go.uuid v1.2.0 ) diff --git a/assets/credhub-service-broker/go.sum b/assets/credhub-service-broker/go.sum index 0333d8314..796a4484c 100644 --- a/assets/credhub-service-broker/go.sum +++ b/assets/credhub-service-broker/go.sum @@ -7,8 +7,8 @@ github.com/cloudfoundry/socks5-proxy v0.2.86/go.mod h1:q5ZvHFcPN7+RtNnsorEyw9XFG github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= -github.com/go-chi/chi/v5 v5.2.1 h1:KOIHODQj58PmL80G2Eak4WdvUzjSJSm0vG72crDCqb8= -github.com/go-chi/chi/v5 v5.2.1/go.mod h1:L2yAIGWB3H+phAw1NxKwWM+7eUH/lU8pOMm5hHcoops= +github.com/go-chi/chi/v5 v5.2.2 h1:CMwsvRVTbXVytCk1Wd72Zy1LAsAh9GxMmSNWLHCG618= +github.com/go-chi/chi/v5 v5.2.2/go.mod h1:L2yAIGWB3H+phAw1NxKwWM+7eUH/lU8pOMm5hHcoops= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= diff --git a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/README.md b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/README.md index 7f662ab45..c58a0e20c 100644 --- a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/README.md +++ b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/README.md @@ -20,7 +20,9 @@ and [docgen](https://github.com/go-chi/docgen). We hope you enjoy it too! ## Install -`go get -u github.com/go-chi/chi/v5` +```sh +go get -u github.com/go-chi/chi/v5 +``` ## Features @@ -194,7 +196,7 @@ type Router interface { // path, with a fresh middleware stack for the inline-Router. Group(fn func(r Router)) Router - // Route mounts a sub-Router along a `pattern`` string. + // Route mounts a sub-Router along a `pattern` string. Route(pattern string, fn func(r Router)) Router // Mount attaches another http.Handler along ./pattern/* diff --git a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/chi.go b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/chi.go index fc32c4efe..2b6ebd337 100644 --- a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/chi.go +++ b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/chi.go @@ -37,8 +37,7 @@ // // A placeholder with a name followed by a colon allows a regular // expression match, for example {number:\\d+}. The regular expression -// syntax is Go's normal regexp RE2 syntax, except that regular expressions -// including { or } are not supported, and / will never be +// syntax is Go's normal regexp RE2 syntax, except that / will never be // matched. An anonymous regexp pattern is allowed, using an empty string // before the colon in the placeholder, such as {:\\d+} // diff --git a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/compress.go b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/compress.go index 28240c4b3..9c64bd48d 100644 --- a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/compress.go +++ b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/compress.go @@ -7,7 +7,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "net" "net/http" "strings" @@ -160,16 +159,14 @@ func (c *Compressor) SetEncoder(encoding string, fn EncoderFunc) { delete(c.encoders, encoding) // If the encoder supports Resetting (IoReseterWriter), then it can be pooled. - encoder := fn(ioutil.Discard, c.level) - if encoder != nil { - if _, ok := encoder.(ioResetterWriter); ok { - pool := &sync.Pool{ - New: func() interface{} { - return fn(ioutil.Discard, c.level) - }, - } - c.pooledEncoders[encoding] = pool + encoder := fn(io.Discard, c.level) + if _, ok := encoder.(ioResetterWriter); ok { + pool := &sync.Pool{ + New: func() interface{} { + return fn(io.Discard, c.level) + }, } + c.pooledEncoders[encoding] = pool } // If the encoder is not in the pooledEncoders, add it to the normal encoders. if _, ok := c.pooledEncoders[encoding]; !ok { @@ -277,16 +274,13 @@ type compressResponseWriter struct { func (cw *compressResponseWriter) isCompressible() bool { // Parse the first part of the Content-Type response header. contentType := cw.Header().Get("Content-Type") - if idx := strings.Index(contentType, ";"); idx >= 0 { - contentType = contentType[0:idx] - } + contentType, _, _ = strings.Cut(contentType, ";") // Is the content type compressible? if _, ok := cw.contentTypes[contentType]; ok { return true } - if idx := strings.Index(contentType, "/"); idx > 0 { - contentType = contentType[0:idx] + if contentType, _, hadSlash := strings.Cut(contentType, "/"); hadSlash { _, ok := cw.contentWildcards[contentType] return ok } diff --git a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/content_charset.go b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/content_charset.go index 07b5ce6f6..07bff9f2e 100644 --- a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/content_charset.go +++ b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/content_charset.go @@ -40,11 +40,10 @@ func contentEncoding(ce string, charsets ...string) bool { // Split a string in two parts, cleaning any whitespace. func split(str, sep string) (string, string) { - var a, b string - var parts = strings.SplitN(str, sep, 2) - a = strings.TrimSpace(parts[0]) - if len(parts) == 2 { - b = strings.TrimSpace(parts[1]) + a, b, found := strings.Cut(str, sep) + a = strings.TrimSpace(a) + if found { + b = strings.TrimSpace(b) } return a, b diff --git a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/content_type.go b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/content_type.go index e61ff2640..cdfc21eec 100644 --- a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/content_type.go +++ b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/content_type.go @@ -31,7 +31,8 @@ func AllowContentType(contentTypes ...string) func(http.Handler) http.Handler { return } - s := strings.ToLower(strings.TrimSpace(strings.Split(r.Header.Get("Content-Type"), ";")[0])) + s, _, _ := strings.Cut(r.Header.Get("Content-Type"), ";") + s = strings.ToLower(strings.TrimSpace(s)) if _, ok := allowedContentTypes[s]; ok { next.ServeHTTP(w, r) @@ -42,4 +43,3 @@ func AllowContentType(contentTypes ...string) func(http.Handler) http.Handler { }) } } - diff --git a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/profiler.go b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/profiler.go index ebd81ee4f..0ad6a996b 100644 --- a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/profiler.go +++ b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/profiler.go @@ -1,3 +1,6 @@ +//go:build !tinygo +// +build !tinygo + package middleware import ( diff --git a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/realip.go b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/realip.go index 55c95a899..afcb79e20 100644 --- a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/realip.go +++ b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/realip.go @@ -47,11 +47,7 @@ func realIP(r *http.Request) string { } else if xrip := r.Header.Get(xRealIP); xrip != "" { ip = xrip } else if xff := r.Header.Get(xForwardedFor); xff != "" { - i := strings.Index(xff, ",") - if i == -1 { - i = len(xff) - } - ip = xff[:i] + ip, _, _ = strings.Cut(xff, ",") } if ip == "" || net.ParseIP(ip) == nil { return "" diff --git a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/route_headers.go b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/route_headers.go index 997bed569..88743769a 100644 --- a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/route_headers.go +++ b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/route_headers.go @@ -133,13 +133,7 @@ type Pattern struct { func NewPattern(value string) Pattern { p := Pattern{} - if i := strings.IndexByte(value, '*'); i >= 0 { - p.wildcard = true - p.prefix = value[0:i] - p.suffix = value[i+1:] - } else { - p.prefix = value - } + p.prefix, p.suffix, p.wildcard = strings.Cut(value, "*") return p } diff --git a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/strip.go b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/strip.go index 1368fa7ab..17aa9bf32 100644 --- a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/strip.go +++ b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/strip.go @@ -3,6 +3,7 @@ package middleware import ( "fmt" "net/http" + "strings" "github.com/go-chi/chi/v5" ) @@ -47,13 +48,12 @@ func RedirectSlashes(next http.Handler) http.Handler { path = r.URL.Path } if len(path) > 1 && path[len(path)-1] == '/' { + // Trim all leading and trailing slashes (e.g., "//evil.com", "/some/path//") + path = "/" + strings.Trim(path, "/") if r.URL.RawQuery != "" { - path = fmt.Sprintf("%s?%s", path[:len(path)-1], r.URL.RawQuery) - } else { - path = path[:len(path)-1] + path = fmt.Sprintf("%s?%s", path, r.URL.RawQuery) } - redirectURL := fmt.Sprintf("//%s%s", r.Host, path) - http.Redirect(w, r, redirectURL, 301) + http.Redirect(w, r, path, 301) return } next.ServeHTTP(w, r) diff --git a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/throttle.go b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/throttle.go index 9a870d88b..b1f926de9 100644 --- a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/throttle.go +++ b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/throttle.go @@ -126,9 +126,9 @@ type token struct{} type throttler struct { tokens chan token backlogTokens chan token + retryAfterFn func(ctxDone bool) time.Duration backlogTimeout time.Duration statusCode int - retryAfterFn func(ctxDone bool) time.Duration } // setRetryAfterHeaderIfNeeded sets Retry-After HTTP header if corresponding retryAfterFn option of throttler is initialized. diff --git a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/wrap_writer.go b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/wrap_writer.go index 12d4faf01..367e0fcd9 100644 --- a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/wrap_writer.go +++ b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/middleware/wrap_writer.go @@ -6,7 +6,6 @@ package middleware import ( "bufio" "io" - "io/ioutil" "net" "net/http" ) @@ -73,10 +72,10 @@ type WrapResponseWriter interface { // http.ResponseWriter interface. type basicWriter struct { http.ResponseWriter - wroteHeader bool + tee io.Writer code int bytes int - tee io.Writer + wroteHeader bool discard bool } @@ -108,7 +107,7 @@ func (b *basicWriter) Write(buf []byte) (n int, err error) { } else if b.tee != nil { n, err = b.tee.Write(buf) } else { - n, err = ioutil.Discard.Write(buf) + n, err = io.Discard.Write(buf) } b.bytes += n return n, err diff --git a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/mux.go b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/mux.go index 91daf691e..f1266971b 100644 --- a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/mux.go +++ b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/mux.go @@ -107,9 +107,8 @@ func (mx *Mux) Use(middlewares ...func(http.Handler) http.Handler) { // Handle adds the route `pattern` that matches any http method to // execute the `handler` http.Handler. func (mx *Mux) Handle(pattern string, handler http.Handler) { - parts := strings.SplitN(pattern, " ", 2) - if len(parts) == 2 { - mx.Method(parts[0], parts[1], handler) + if method, rest, found := strings.Cut(pattern, " "); found { + mx.Method(method, rest, handler) return } @@ -119,9 +118,8 @@ func (mx *Mux) Handle(pattern string, handler http.Handler) { // HandleFunc adds the route `pattern` that matches any http method to // execute the `handlerFn` http.HandlerFunc. func (mx *Mux) HandleFunc(pattern string, handlerFn http.HandlerFunc) { - parts := strings.SplitN(pattern, " ", 2) - if len(parts) == 2 { - mx.Method(parts[0], parts[1], handlerFn) + if method, rest, found := strings.Cut(pattern, " "); found { + mx.Method(method, rest, handlerFn) return } diff --git a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/path_value.go b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/path_value.go index 7e78171e5..77c840f01 100644 --- a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/path_value.go +++ b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/path_value.go @@ -1,5 +1,6 @@ -//go:build go1.22 -// +build go1.22 +//go:build go1.22 && !tinygo +// +build go1.22,!tinygo + package chi diff --git a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/path_value_fallback.go b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/path_value_fallback.go index f551781a4..749a8520a 100644 --- a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/path_value_fallback.go +++ b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/path_value_fallback.go @@ -1,5 +1,5 @@ -//go:build !go1.22 -// +build !go1.22 +//go:build !go1.22 || tinygo +// +build !go1.22 tinygo package chi diff --git a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/tree.go b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/tree.go index c7d3bc570..85fcfdbb8 100644 --- a/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/tree.go +++ b/assets/credhub-service-broker/vendor/github.com/go-chi/chi/v5/tree.go @@ -730,11 +730,9 @@ func patNextSegment(pattern string) (nodeTyp, string, string, byte, int, int) { tail = pattern[pe] } - var rexpat string - if idx := strings.Index(key, ":"); idx >= 0 { + key, rexpat, isRegexp := strings.Cut(key, ":") + if isRegexp { nt = ntRegexp - rexpat = key[idx+1:] - key = key[:idx] } if len(rexpat) > 0 { diff --git a/assets/credhub-service-broker/vendor/modules.txt b/assets/credhub-service-broker/vendor/modules.txt index 6fbd9a50e..0c3328ba6 100644 --- a/assets/credhub-service-broker/vendor/modules.txt +++ b/assets/credhub-service-broker/vendor/modules.txt @@ -16,7 +16,7 @@ github.com/cloudfoundry/go-socks5 # github.com/cloudfoundry/socks5-proxy v0.2.86 ## explicit; go 1.20 github.com/cloudfoundry/socks5-proxy -# github.com/go-chi/chi/v5 v5.2.1 +# github.com/go-chi/chi/v5 v5.2.2 ## explicit; go 1.20 github.com/go-chi/chi/v5 github.com/go-chi/chi/v5/middleware