Skip to main content

Echo 5.4.7

Release Date: November 20, 2026

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 %2e form, could be resolved by Rewrite, RegexRewrite or the upstream itself into a path the router never matched. A request such as GET /api/x/../admin/users matched an unprotected /api/* proxy group but reached the upstream as /admin/users, skipping authentication attached to /api/admin. Echo now returns 400 Bad Request for 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.Static and Group.StaticFS registered prefix* when the given prefix had no trailing slash. With e.Static("/assets", root), the request /assetsadmin/private.txt was served from <root>/admin/private.txt, bypassing a guard on /assets/admin. These functions now register prefix/*, plus prefix for the redirect to prefix/.
  • Static middleware on a group (GHSA-5hp7-4fcm-57f9). The documentation now states that middleware.Static attached with Group#Use is not protected by guards on routes inside the group or on nested groups, and that Group#Static should 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, []string or any now returns an error instead of silently skipping values, and named string types no longer panic (#3235, fixed in #3238).
  • Gzip middleware. Accept-Encoding quality values are honoured: gzip;q=0 refuses gzip, x-gzip is accepted, and substrings such as notgzip no longer match. Responses that already carry a Content-Encoding, for example from a reverse proxy, are passed through instead of being compressed twice. The same pull request fixes Write reporting more bytes than it received at the MinLength threshold, a truncated stream when a handler only flushes, and stale Content-Length and Content-Encoding headers (#3232, #2788, #3239).
  • Response. Flush commits an uncommitted response, WriteHeader passes 1xx informational codes such as 103 Early Hints through without committing, and the built-in error handlers remove Content-Encoding, Content-Length and Content-Disposition before 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.

Other Versions

We use cookies for ads and analytics.