High performance, minimalist Go web framework
Repo labstack/echo, read from GitHub 19 min ago. labstack has not joined Take My Repo.
Security
. or .. path segment (also encoded as %2e) was resolved by Rewrite/RegexRewrite or by the upstream into a path the router never matched, bypassing route and group middleware such as authentication. After routing, Proxy now returns 400 Bad Request for such paths, and rewrite targets in Proxy and the Rewrite middleware are applied literally instead of being resolved; a target with a dot segment or a leading // is rejected. Fixes GHSA-w5j2-g3fc-pwr6. Reported by AndyAnh174.Static, StaticFS, Group.Static and Group.StaticFS with a prefix without a trailing slash registered prefix*, so /assetsadmin/private.txt was served from <root>/admin/private.txt for e.Static("/assets", root), bypassing a guard on /assets/admin. They now register prefix/*, plus prefix for the redirect to prefix/. Fixes GHSA-76qj-xf66-r429. Reported by AndyAnh174.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. See GHSA-5hp7-4fcm-57f9. Reported by AndyAnh174.Behavior changes
./.. segments, and a Rewrite middleware attached after routing applies its targets literally: relative targets and absolute URLs are rejected. Echo#Pre is unchanged.Static and StaticFS return the route for prefix/* instead of prefix*, and file names that only start with the prefix are no longer served.No public API, dependency or minimum Go-version changes; Go 1.26 or later remains required.
Security
. or .. path segment (also encoded as %2e) was resolved by Rewrite/RegexRewrite or by the upstream into a path the router never matched. GET /api/x/../admin/users matched an unprotected /api/* proxy group but reached the upstream as /admin/users, skipping middleware such as authentication on /api/admin. After routing, Proxy now returns 400 Bad Request for such paths, and rewrite targets in Proxy and the Rewrite middleware are applied literally instead of being resolved; a target with a dot segment or a leading // is rejected. Fixes GHSA-w5j2-g3fc-pwr6. Reported by AndyAnh174.Static, StaticFS, Group.Static and Group.StaticFS with a prefix without a trailing slash registered prefix*, so /assetsadmin/private.txt was served from <root>/admin/private.txt for e.Static("/assets", root), bypassing a guard on /assets/admin. They now register prefix/*, plus prefix for the redirect to prefix/. Fixes GHSA-76qj-xf66-r429. Reported by AndyAnh174.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. See GHSA-5hp7-4fcm-57f9. Reported by AndyAnh174.Fixes
string, []string or any returns an error instead of skipping the values, and named string types no longer panic. Fixes #3235 in #3238.Accept-Encoding quality values are honored (gzip;q=0 refuses gzip, x-gzip is accepted, substrings such as notgzip no longer match), and responses that already have a Content-Encoding, for example from a reverse proxy, are passed through instead of compressed twice. Also fixes Write reporting more bytes than given at the MinLength threshold, a truncated stream when a handler only flushes, and stale Content-Length and Content-Encoding headers. Fixes #3232 and #2788 in #3239.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. Fixes #3240, #3241 and #3242 in #3243.Behavior changes
./.. segments, and a Rewrite middleware attached after routing (on Echo#Use, a group or a route) applies its targets literally: relative targets and absolute URLs are rejected. Echo#Pre is unchanged.Static and StaticFS return the RouteInfo of prefix/* instead of prefix*, and file names that only start with the prefix (for example /img-logo.png for e.Static("/img-", dir)) are no longer served.400 Bad Request.Content-Encoding itself is assumed to have encoded the body; the Gzip middleware no longer compresses it.HTTPErrorHandlers still need to clear stale Content-Encoding, Content-Length and Content-Disposition themselves.No dependency or minimum Go-version changes.
Security
X-Forwarded-Proto from the upstream request by naming it in the Connection header, on plain HTTP requests and WebSocket upgrades. The proxy now sets X-Forwarded-Proto again after Go removes hop-by-hop headers, as it already does for X-Real-IP. Fixes GHSA-h6x5-phvw-c55c. Reported by zachary-satterly.Behavior change
A custom balancer that replaces the request and sets its own X-Forwarded-Proto no longer reaches the upstream with that value; the proxy uses the scheme of the original request. A custom ProxyConfig.Transport can still set the header.
No public API, dependency or minimum Go-version changes; Go 1.26 or later remains required.
Security
X-Forwarded-Proto from the upstream request by naming it in the Connection header, on plain HTTP requests and WebSocket upgrades. The proxy now sets X-Forwarded-Proto again after Go removes hop-by-hop headers, as it already does for X-Real-IP. Fixes GHSA-h6x5-phvw-c55c. Reported by zachary-satterly.Behavior change
A custom balancer that replaces the request and sets its own X-Forwarded-Proto no longer reaches the upstream with that value; the proxy uses the scheme of the original request. A custom ProxyConfig.Transport can still set the header.
No public API, dependency or minimum Go-version changes.
Security
HTTPSRedirect, HTTPSWWWRedirect, HTTPSNonWWWRedirect, WWWRedirect and NonWWWRedirect now return 400 Bad Request instead of redirecting when the host is empty, starts with : or ., contains %, or is empty after removing www.. Before this change, such hosts could produce an open redirect. The middleware no longer redirects OPTIONS * requests, maps ws and wss to http and https in redirect targets, and matches the www. prefix case-insensitively. Fixes GHSA-3f6j-cw5h-qw9c (#3217) in #3220.Fixes
AddTrailingSlash and RemoveTrailingSlash keep escaped path segments such as %2F in redirect and forward targets, so the request still matches its original route. Fixes #3206 in #3221.ExtractIPFromXFFHeader and ExtractIPFromRealIPHeader trust zoned link-local proxy peers such as [fe80::1%eth0]:8080, with or without a port. Fixes #3179 in #3222.BindHeaders no longer panics on nil or empty header value slices. Fixes #3169 in #3223.Behavior change
Context.RealIP() and ExtractIPDirect() now return a zoned link-local peer without its zone: fe80::1, not fe80::1%eth0. Update logs, allowlists or rate-limit keys that store the zoned form.
No public API, dependency or minimum Go-version changes.
Security
HTTPSRedirect, HTTPSWWWRedirect, HTTPSNonWWWRedirect, WWWRedirect and NonWWWRedirect now return 400 Bad Request instead of redirecting when the host is empty, starts with : or ., contains %, or is empty after removing www.. Before this change, such hosts could produce an open redirect. The middleware no longer redirects OPTIONS * requests, maps ws and wss to http and https in redirect targets, and matches the www. prefix case-insensitively. Fixes GHSA-3f6j-cw5h-qw9c (#3217) in #3224.Fixes
AddTrailingSlash and RemoveTrailingSlash keep escaped path segments such as %2F in redirect and forward targets, so the request still matches its original route. Fixes #3206 in #3225.ExtractIPFromXFFHeader and ExtractIPFromRealIPHeader trust zoned link-local proxy peers such as [fe80::1%eth0]:8080, with or without a port. Fixes #3179 in #3226.BindHeaders no longer panics on nil or empty header value slices. Fixes #3169 in #3227.Behavior changes
Context.RealIP() and ExtractIPDirect() now return a zoned link-local peer without its zone: fe80::1, not fe80::1%eth0. Update logs, allowlists or rate-limit keys that store the zoned form.HTTPSWWWRedirect keeps its v4 behavior: it does not redirect plain HTTP requests for hosts that already start with www.. v5 redirects these requests.No public API, dependency or minimum Go-version changes; Go 1.26 or later remains required.