Echo 5.4.7
Echo 5.4.7 was released on November 20, 2026. The release is a security update for the v5 line, published alongside v4.16.6 for projects that have not migrated yet. Both versions carry the same three advisories and the same hardening of proxy path handling, static file registration and gzip negotiation. There are no public API changes and no dependency or minimum Go version changes.
Overview
Three security advisories and four behavioural fixes make up this release. The first is a routing bypass in the proxy middleware, the second is a prefix collision in the static file handler, and the third is a documentation gap around static middleware attached to a group. All three were reported by AndyAnh174 and are credited in the advisory text.
Security
- Proxy path resolution bypass (GHSA-w5j2-g3fc-pwr6). After routing, a
.or..segment, including the encoded%2eform, could be resolved byRewrite,RegexRewriteor the upstream itself into a path the router never matched. A request such asGET /api/x/../admin/usersmatched an unprotected/api/*proxy group but reached the upstream as/admin/users, skipping authentication attached to/api/admin. Echo now returns400 Bad Requestfor such paths after routing, and rewrite targets in Proxy and in the Rewrite middleware are applied literally instead of being resolved. A target containing a dot segment or a leading//is rejected. - Static file prefix collision (GHSA-76qj-xf66-r429).
Static,StaticFS,Group.StaticandGroup.StaticFSregisteredprefix*when the given prefix had no trailing slash. Withe.Static("/assets", root), the request/assetsadmin/private.txtwas served from<root>/admin/private.txt, bypassing a guard on/assets/admin. These functions now registerprefix/*, plusprefixfor the redirect toprefix/. - Static middleware on a group (GHSA-5hp7-4fcm-57f9). The documentation now states that
middleware.Staticattached withGroup#Useis not protected by guards on routes inside the group or on nested groups, and thatGroup#Staticshould be used for files behind such guards.
Fixes
- Map binding. Binding path, query, header or form data into a map whose value type is not
string,[]stringoranynow returns an error instead of silently skipping values, and named string types no longer panic (#3235, fixed in #3238). - Gzip middleware.
Accept-Encodingquality values are honoured:gzip;q=0refuses gzip,x-gzipis accepted, and substrings such asnotgzipno longer match. Responses that already carry aContent-Encoding, for example from a reverse proxy, are passed through instead of being compressed twice. The same pull request fixesWritereporting more bytes than it received at theMinLengththreshold, a truncated stream when a handler only flushes, and staleContent-LengthandContent-Encodingheaders (#3232, #2788, #3239). - Response.
Flushcommits an uncommitted response,WriteHeaderpasses 1xx informational codes such as103 Early Hintsthrough without committing, and the built-in error handlers removeContent-Encoding,Content-LengthandContent-Dispositionbefore writing the error body (#3240, #3241, #3242, #3243).
Behaviour Changes
Proxy rejects dot segments after routing, and a Rewrite middleware attached after routing applies its targets literally, so relative targets and absolute URLs are rejected. Echo#Pre is unchanged. Static and StaticFS return the RouteInfo of prefix/* rather than prefix*, and file names that only start with the prefix, such as /img-logo.png for e.Static("/img-", dir), are no longer served. Binding into an unsupported map type returns 400 Bad Request. A handler that sets Content-Encoding itself is assumed to have encoded the body, so the gzip middleware leaves it alone. Custom HTTPErrorHandler implementations still need to clear stale Content-Encoding, Content-Length and Content-Disposition themselves.
How to Upgrade
Update the module to v5.4.7 and re-run the test suite. Projects still on v4 can move to v4.16.6, which is identical in scope and keeps the existing API. If you serve static files through a route group with a guard, review those mounts and switch to Group#Static where the guard is expected to apply. Reverse proxies that rewrite paths before forwarding deserve a second look as well, since a relative rewrite target now fails on Echo's side.