npm hono 4.13.18
v4.13.18

one hour ago

Security fixes

This release includes fixes for the following security issues:

validator() skips validation for requests whose Content-Type parameters are formatted differently

Affects: validator('json') and validator('form') in hono/validator. A Content-Type with whitespace before ;, a trailing ;, or an unusual parameter name was not recognized, so the validator saw an empty object while the handler could read all fields. This completes the fix for GHSA-4h7h-rv7c-7m2v. The validator now decides by the media type alone, as c.req.parseBody() does. GHSA-92p4-j3wq-jmqx

bodyLimit() keeps every transfer chunk of a request body in memory

Affects: bodyLimit() in hono/body-limit. A body sent in very small transfer chunks was retained as one object per chunk, so a request within the configured limit could exhaust memory. The body is now buffered in one array bounded by maxSize. GHSA-39q9-qp46-w8xg

mount() and app.mount() forward a wrong path when a custom getPath adds a prefix

Affects: mount() in hono/mount and app.mount() on 4.13.16 and 4.13.17. With a getPath that prepends a prefix such as the host name, one segment too many was removed from the forwarded path, so middleware scoped inside the mount prefix could be skipped. The prefix is removed from the routed path again. Paths that would change meaning when forwarded now get 400, and an optional regular expression parameter in a mount path throws. GHSA-h25j-2p75-qj33

serveStatic() serves a path that was decoded twice when allowPercentInPath is enabled

Affects: serveStatic() in hono/serve-static and the runtime adapters, only with allowPercentInPath: true. A malformed percent escape in the request path was decoded a second time, so a path that middleware registered on the encoded form did not see could still reach a static file. The file path must now be the same as the routed path, and otherwise the response is 404. GHSA-74fm-fwc7-3fwp


Users who rely on validator(), bodyLimit(), mount() with a custom getPath, or serveStatic() with allowPercentInPath are strongly encouraged to upgrade to this version.

Full Changelog: v4.13.17...v4.13.18

Don't miss a new hono release

NewReleases is sending notifications on new releases.