build(deps): bump github.com/labstack/echo/v4 from 4.15.3 to 4.16.1 in /samples/server/petstore/go-echo-server
Bumps github.com/labstack/echo/v4 from 4.15.3 to 4.16.1.
Release notes
Sourced from github.com/labstack/echo/v4's releases.
v4.16.1
Security fixes
Upgrade with
go get github.com/labstack/echo/v4@v4.16.1.Go 1.26 or later is now required to use patched
golang.org/x/dependencies. Build deployments with a supported, patched Go toolchain.
- Validate upstream WebSocket upgrade responses through Go's HTTP reverse proxy. Rejected upgrades no longer leave a raw tunnel that bypasses Echo routing and route middleware. GHSA-cxf3-9h37-7rr8
- Close both WebSocket connections when either side disconnects, including when an upstream ignores client EOF. GHSA-9969-6676-49h5
- Bound BodyDump request and response captures to 5 MiB each by default while preserving complete payload delivery and request read errors. GHSA-f48p-c9v4-h7xv
- Bound decompressed request bodies to 100 MiB by default. Overflow returns HTTP 413, including through JSON and XML binding; exactly-at-limit bodies remain valid. GHSA-h7wr-284f-5qvc
- Upgrade
golang.org/x/netto v0.60.0 and related dependencies, addressing GO-2026-6617, GO-2026-6612, GO-2026-6611, GO-2026-6610 and GO-2026-6603.- Include the BodyLimit overflow-check correction and static-path hardening already merged since v4.16.0.
Behavior to review when upgrading
BodyDumpConfig.MaxRequestBytesandMaxResponseBytescontrol capture limits. Zero selects the 5 MiB default;-1disables a limit. These limits affect captured logging data only: handlers and clients still receive complete bodies.
DecompressConfig.MaxDecompressedSizecontrols the decompressed-body limit. Zero selects the 100 MiB default;-1disables it. Apply any smaller application body limit after decompression, and handle request-body read errors.The proxy removes incoming
Forwardedheaders as defensive hardening. Backends relying on that header should use forwarding headers generated from the configured trusted IP extractor and scheme. WebSocket requests now honor the configured proxy transport, response modifier, target path and query in the same way as HTTP requests;wsandwsstargets remain supported.Other changes
This release includes router fixes for escaped colons, inline verbs and parameter storage, binding support for OpenAPI date formats, and documentation updates. Benchmark comparisons now run only for pull requests with shorter samples.
Thanks to
@Duodum,@irisitymichaelgrundberg,@q490107865,@Hama1cco,@jakezwangand@Shubham-Padkondefor reports and contributions, and to the contributors credited in the individual commits.Validation: upstream lint checks and race tests passed on Linux, macOS and Windows with Go 1.26 and 1.27. Local tests on patched toolchains, vet, staticcheck and govulncheck also passed; govulncheck reported no reachable vulnerabilities. The module graph still contains an advisory for the unused, unmaintained
golang.org/x/crypto/openpgppackage (GO-2026-5932), which Echo does not import and for which no fixed dependency version is available.Full changelog: https://github.com/labstack/echo/compare/v4.16.0...v4.16.1
v4.16.0
Security
This release fixes several security issues. Upgrading is recommended. Some fixes change behavior; read "Behavior changes to check before upgrading" below.
- Request scheme:
Context.Scheme()now uses theX-Forwarded-Proto,X-Forwarded-Protocol,X-Forwarded-SslandX-Url-Schemeheaders only when the request comes directly from a loopback, link-local or private network address or a unix socket. Before this, any client could sendX-Forwarded-Proto: httpsover plain HTTP and skipHTTPSRedirect. WhenX-Forwarded-Protois present, only it is used (its last value), and the scheme is returned in lowercase. the newEcho#SchemeExtractorfield selects the strategy:ExtractSchemeFromHeaders(...TrustOption)(default),ExtractSchemeDirect()orLegacySchemeExtractor(). The Secure middleware now sets HSTS based onContext.Scheme(). The Proxy middleware always setsX-Forwarded-ProtofromContext.Scheme()and removesX-Forwarded-Ssl,X-Forwarded-ProtocolandX-Url-Schemebefore forwarding. GHSA-2ffq-g2xg-c22p- JSONP:
Context.JSONPandContext.JSONPBlobaccept only a callback that is empty, a JavaScript identifier or a dot-separated path of identifiers (ASCII letters, digits,_and$). Any other callback returns a 400 Bad Request error that wraps the newErrInvalidJSONPCallback, and nothing is written. JSONP responses now carryX-Content-Type-Options: nosniff. JSONP lets any website read the response with the user's cookies, so do not use it for data that needs authentication. GHSA-h9g5-28mm-hx3g- MethodOverride: a POST can no longer be overridden to
GET,HEAD,OPTIONS,TRACEorCONNECT. Before this, with theMethodFromFormorMethodFromQuerygetter and MethodOverride registered withUsebefore the CSRF middleware,_method=GETskipped the CSRF check. Register MethodOverride withEcho#Pre. GHSA-r7w9-592q-9vg4- Redirects: the trailing slash middlewares and the static directory redirect percent-encode control characters in the redirect path. Before this,
/%09/evil.example/redirected browsers toevil.example. GHSA-v753-g4cw-jm48- Static files: with the default settings, the Static middleware resolves files from the same form of the path that the router matched, so
/admin%2Fsecret.txtor/%61dmin/secret.txtcan no longer reach a file under a guarded/admin/*route. GHSA-375p-5qhx-8wq4 The Static middleware andStaticDirectoryHandler(used byEcho.Static,Echo.StaticFS,Group.StaticandGroup.StaticFS) no longer serve paths with a.,..or empty segment, such as/assets/../admin/secret.txt, also after path unescaping. GHSA-3pmx-cf9f-34xr- Dependencies: update
golang.org/x/textto v0.40.0 (GO-2026-5970).Client IP address (no code change in v4)
Without
Echo#IPExtractor,Context.RealIP()in v4 trusts theX-Forwarded-ForandX-Real-IPheaders from any client, so the rate limiter can be bypassed and the Proxy middleware forwards a spoofedX-Real-IP(GHSA-246p-cpwv-v3jq, GHSA-99jh-6h7p-pp36). Changing this default in v4 would put all clients behind a proxy into one rate-limit bucket, so v4 keeps it. Set an extractor that matches your deployment:e.IPExtractor = echo.ExtractIPDirect() // no proxy in front of the app e.IPExtractor = echo.ExtractIPFromXFFHeader() // behind proxies in private networks that set X-Forwarded-For </tr></table>
... (truncated)
Commits
600b985chore: prepare v4.16.1 security release (#3186)3fb0ba7Merge commit from forkbe08005fix(router): grow param values for contexts created before a route with more ...320fe67fix(bind): honor OpenAPI date, date-time and date-time-local format tags (v4)...f085ffbfix(router): handle escaped colons and inline verbs in v4 (#3132)5440f99fix(middleware): prevent BodyLimit bypass in v4 (#3131)577ba39static: harden dot-segment check for backslashes, test non-validating custom ...5730445docs: add Blacksmith to sponsors (#3127)a7109fadocs: link the OpenTelemetry middleware at labstack/echo-otel (#3125)e75c6c6Merge pull request #3120 from labstack/chore/v4-bump-x-text- Additional commits viewable in compare view
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebasewill rebase this PR@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it@dependabot show <dependency name> ignore conditionswill show all of the ignore conditions of the specified dependency@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the Security Alerts page.