Security fixes
This release includes fixes for the following security issues:
TrieRouter treats __proto__ as a registered HTTP method
Affects: applications that use TrieRouter and accept arbitrary method names, for example with HTTP/2 on Node.js or with hono/method-override. A request with a method name such as __proto__ made the router add a property to Object.prototype, so later requests in the same process could fail until it was restarted. The router no longer treats an inherited property as a registered method. GHSA-656w-x92q-369m
except() skips a middleware for a path that only starts or ends with an alternative of a constrained parameter
Affects: except() in hono/combine, with a path condition that has an alternation in a constrained parameter. A path that only started or ended with one of the alternatives also matched the condition, so the middleware did not run for it. The regular expression of a parameter is now grouped, and routes on TrieRouter with such a parameter are corrected by the same change. GHSA-586x-c76g-h528
getPath() drops the first path segment when the request URL has no scheme and host
Affects: applications on Bun that rely on path rules of a reverse proxy to protect routes. Bun gives a URL with only the path for a request without a usable Host header, and Hono dropped the first segment of the path before routing, so a request could reach a route that the proxy blocks by path. The path of such a URL is now read correctly. GHSA-mhwf-w6q6-q58w
Users who use TrieRouter with HTTP/2 on Node.js or hono/method-override, except() with a constrained parameter, or Bun behind a reverse proxy are strongly encouraged to upgrade to this version.
Full Changelog: v4.13.22...v4.13.23