Open renovate[bot] opened 11 months ago
[!IMPORTANT]
Review skipped
Bot user detected.
To trigger a single review, invoke the
@coderabbitai review
command.You can disable this status message by setting the
reviews.review_status
tofalse
in the CodeRabbit configuration file.
This PR contains the following updates:
^2.3.0
->^4.0.0
GitHub Vulnerability Alerts
CVE-2023-50710
Impact
The clients may override named path parameter values from previous requests if the application is using TrieRouter. So, there is a risk that a privileged user may use unintended parameters when deleting REST API resources.
TrieRouter is used either explicitly or when the application matches a pattern that is not supported by the default RegExpRouter.
The code to reproduce it. The server side application:
The client code which makes requests to the server application:
The results:
Patches
"v3.11.7" includes the change to fix this issue.
Workarounds
Don't use TrieRouter directly.
References
Router options on the Hono website: https://hono.dev/api/hono#router-option
CVE-2024-32869
Summary
When using serveStatic with deno, it is possible to directory traverse where main.ts is located.
My environment is configured as per this tutorial https://hono.dev/getting-started/deno
PoC
source
request
response is content of main.ts
Impact
Unexpected files are retrieved.
CVE-2024-43787
Summary
Hono CSRF middleware can be bypassed using crafted Content-Type header.
Details
MIME types are case insensitive, but
isRequestedByFormElementRe
only matches lower-case.https://github.com/honojs/hono/blob/b0af71fbcc6dbe44140ea76f16d68dfdb32a99a0/src/middleware/csrf/index.ts#L16-L17
As a result, attacker can bypass csrf middleware using upper-case form-like MIME type, such as "Application/x-www-form-urlencoded".
PoC
Impact
Bypass csrf protection implemented with hono csrf middleware.
Discussion
I'm not sure that omitting csrf checks for Simple POST request is a good idea. CSRF prevention and CORS are different concepts even though CORS can prevent CSRF in some cases.
CVE-2024-48913
Summary
Bypass CSRF Middleware by a request without Content-Type herader.
Details
Although the csrf middleware verifies the Content-Type Header, Hono always considers a request without a Content-Type header to be safe.
https://github.com/honojs/hono/blob/cebf4e87f3984a6a034e60a43f542b4c5225b668/src/middleware/csrf/index.ts#L76-L89
PoC
Similarly, the fetch API does not add a Content-Type header for requests that do not include a Body.
Impact
Bypass csrf protection implemented with hono csrf middleware.
Release Notes
honojs/hono (hono)
### [`v4.6.5`](https://redirect.github.com/honojs/hono/releases/tag/v4.6.5) [Compare Source](https://redirect.github.com/honojs/hono/compare/v4.6.4...v4.6.5) #### Security fix for CSRF Protection Middleware This release includes a security fix for CSRF Protection Middleware. If you are using CSRF Protection Middleware, please upgrade this `hono` package immediately. Before this release, a request without a `Content-Type` header can bypass the protection. This fix does not allow it. See: https://github.com/honojs/hono/security/advisories/GHSA-2234-fmw7-43wr #### What's Changed - perf(types): replace intersection with union to get better perf by [@m-shaka](https://redirect.github.com/m-shaka) in [https://github.com/honojs/hono/pull/3443](https://redirect.github.com/honojs/hono/pull/3443) - ci: use Deno `v2` by [@yusukebe](https://redirect.github.com/yusukebe) in [https://github.com/honojs/hono/pull/3506](https://redirect.github.com/honojs/hono/pull/3506) - ci: use Deno v2 for a test running for deno by [@nakasyou](https://redirect.github.com/nakasyou) in [https://github.com/honojs/hono/pull/3509](https://redirect.github.com/honojs/hono/pull/3509) - fix(types): rm ExcludeEmptyObject to fix massively increased type instantiations by [@m-shaka](https://redirect.github.com/m-shaka) in [https://github.com/honojs/hono/pull/3507](https://redirect.github.com/honojs/hono/pull/3507) - fix(cors): avoid setting `Access-Control-Allow-Origin` if there is no matching origin by [@uki00a](https://redirect.github.com/uki00a) in [https://github.com/honojs/hono/pull/3510](https://redirect.github.com/honojs/hono/pull/3510) - feat(powered-by): optional server name by [@PatrickJS](https://redirect.github.com/PatrickJS) in [https://github.com/honojs/hono/pull/3492](https://redirect.github.com/honojs/hono/pull/3492) - fix(factory): revert PR [#3498](https://redirect.github.com/honojs/hono/issues/3498) by [@yusukebe](https://redirect.github.com/yusukebe) in [https://github.com/honojs/hono/pull/3515](https://redirect.github.com/honojs/hono/pull/3515) - fix(build): remove private fields by [@nakasyou](https://redirect.github.com/nakasyou) in [https://github.com/honojs/hono/pull/3514](https://redirect.github.com/honojs/hono/pull/3514) #### New Contributors - [@uki00a](https://redirect.github.com/uki00a) made their first contribution in [https://github.com/honojs/hono/pull/3510](https://redirect.github.com/honojs/hono/pull/3510) - [@PatrickJS](https://redirect.github.com/PatrickJS) made their first contribution in [https://github.com/honojs/hono/pull/3492](https://redirect.github.com/honojs/hono/pull/3492) **Full Changelog**: https://github.com/honojs/hono/compare/v4.6.4...v4.6.5 ### [`v4.6.4`](https://redirect.github.com/honojs/hono/releases/tag/v4.6.4) [Compare Source](https://redirect.github.com/honojs/hono/compare/v4.6.3...v4.6.4) #### What's Changed - chore: upgrade dependencies by [@yusukebe](https://redirect.github.com/yusukebe) in [https://github.com/honojs/hono/pull/3446](https://redirect.github.com/honojs/hono/pull/3446) - chore: remove `crypto-js` from dev dependencies by [@yusukebe](https://redirect.github.com/yusukebe) in [https://github.com/honojs/hono/pull/3447](https://redirect.github.com/honojs/hono/pull/3447) - chore(test): suppress no-unused-vars "'x' is assigned a value but only used as type" by [@exoego](https://redirect.github.com/exoego) in [https://github.com/honojs/hono/pull/3451](https://redirect.github.com/honojs/hono/pull/3451) - chore(test): include bun coverage by [@exoego](https://redirect.github.com/exoego) in [https://github.com/honojs/hono/pull/3457](https://redirect.github.com/honojs/hono/pull/3457) - test(deno): remove duplicated app.get by [@exoego](https://redirect.github.com/exoego) in [https://github.com/honojs/hono/pull/3469](https://redirect.github.com/honojs/hono/pull/3469) - fix(types): add key to IntrinsicAttributes by [@codehz](https://redirect.github.com/codehz) in [https://github.com/honojs/hono/pull/3474](https://redirect.github.com/honojs/hono/pull/3474) - fix(factory): relax Bindings and Variables for `createMiddleware` by [@yusukebe](https://redirect.github.com/yusukebe) in [https://github.com/honojs/hono/pull/3498](https://redirect.github.com/honojs/hono/pull/3498) - fix(service-worker): bind fetch to `globalThis` by [@sapphi-red](https://redirect.github.com/sapphi-red) in [https://github.com/honojs/hono/pull/3500](https://redirect.github.com/honojs/hono/pull/3500) - refactor(jsx): add `override` to `toStringToBuffer` in classes extending `JSXNode` by [@yusukebe](https://redirect.github.com/yusukebe) in [https://github.com/honojs/hono/pull/3505](https://redirect.github.com/honojs/hono/pull/3505) #### New Contributors - [@sapphi-red](https://redirect.github.com/sapphi-red) made their first contribution in [https://github.com/honojs/hono/pull/3500](https://redirect.github.com/honojs/hono/pull/3500) **Full Changelog**: https://github.com/honojs/hono/compare/v4.6.3...v4.6.4 ### [`v4.6.3`](https://redirect.github.com/honojs/hono/releases/tag/v4.6.3) [Compare Source](https://redirect.github.com/honojs/hono/compare/v4.6.2...v4.6.3) This release has many new features, but each feature is small, so we've released it as a patch release. #### What's Changed - chore: rename `runtime_tests` to `runtime-tests` by [@yusukebe](https://redirect.github.com/yusukebe) in [https://github.com/honojs/hono/pull/3419](https://redirect.github.com/honojs/hono/pull/3419) - ci: Type check perf by [@m-shaka](https://redirect.github.com/m-shaka) in [https://github.com/honojs/hono/pull/3406](https://redirect.github.com/honojs/hono/pull/3406) - refactor(jsx/streaming): Clarified the type of renderToReadableStream. by [@usualoma](https://redirect.github.com/usualoma) in [https://github.com/honojs/hono/pull/3434](https://redirect.github.com/honojs/hono/pull/3434) - perf(types): use homomorphic mapped type to reduce conditional branches by [@m-shaka](https://redirect.github.com/m-shaka) in [https://github.com/honojs/hono/pull/3440](https://redirect.github.com/honojs/hono/pull/3440) - ci: prettify type check result and rm a comment by [@m-shaka](https://redirect.github.com/m-shaka) in [https://github.com/honojs/hono/pull/3442](https://redirect.github.com/honojs/hono/pull/3442) - fix(types): useSyncExternalStore type by [@codehz](https://redirect.github.com/codehz) in [https://github.com/honojs/hono/pull/3437](https://redirect.github.com/honojs/hono/pull/3437) - fix(combine/every): make `every` middleware work with short-circuiting middlewares by [@paolostyle](https://redirect.github.com/paolostyle) in [https://github.com/honojs/hono/pull/3441](https://redirect.github.com/honojs/hono/pull/3441) - feat(secureHeader): add CSP Report-Only mode support by [@isoppp](https://redirect.github.com/isoppp) in [https://github.com/honojs/hono/pull/3413](https://redirect.github.com/honojs/hono/pull/3413) - feat(jwt): make JwtVariables generic for improved type safety by [@TinsFox](https://redirect.github.com/TinsFox) in [https://github.com/honojs/hono/pull/3428](https://redirect.github.com/honojs/hono/pull/3428) - feat(request): Make request.ts available throught JSR for frameworks that need to instantiate HonoRequest by [@Sorikairox](https://redirect.github.com/Sorikairox) in [https://github.com/honojs/hono/pull/3425](https://redirect.github.com/honojs/hono/pull/3425) - feat(jsx/precompile): Normalization and stringification of attribute values as `renderToString` by [@usualoma](https://redirect.github.com/usualoma) in [https://github.com/honojs/hono/pull/3432](https://redirect.github.com/honojs/hono/pull/3432) - feat(serve-static): support absolute root by [@yusukebe](https://redirect.github.com/yusukebe) in [https://github.com/honojs/hono/pull/3420](https://redirect.github.com/honojs/hono/pull/3420) #### New Contributors - [@codehz](https://redirect.github.com/codehz) made their first contribution in [https://github.com/honojs/hono/pull/3437](https://redirect.github.com/honojs/hono/pull/3437) - [@paolostyle](https://redirect.github.com/paolostyle) made their first contribution in [https://github.com/honojs/hono/pull/3441](https://redirect.github.com/honojs/hono/pull/3441) - [@isoppp](https://redirect.github.com/isoppp) made their first contribution in [https://github.com/honojs/hono/pull/3413](https://redirect.github.com/honojs/hono/pull/3413) - [@TinsFox](https://redirect.github.com/TinsFox) made their first contribution in [https://github.com/honojs/hono/pull/3428](https://redirect.github.com/honojs/hono/pull/3428) - [@Sorikairox](https://redirect.github.com/Sorikairox) made their first contribution in [https://github.com/honojs/hono/pull/3425](https://redirect.github.com/honojs/hono/pull/3425) **Full Changelog**: https://github.com/honojs/hono/compare/v4.6.2...v4.6.3 ### [`v4.6.2`](https://redirect.github.com/honojs/hono/releases/tag/v4.6.2) [Compare Source](https://redirect.github.com/honojs/hono/compare/v4.6.1...v4.6.2) #### What's Changed - chore(lint): ESLint v9 by [@yusukebe](https://redirect.github.com/yusukebe) in [https://github.com/honojs/hono/pull/3393](https://redirect.github.com/honojs/hono/pull/3393) - perf(serve-static): performance optimization for precompressed feature by [@usualoma](https://redirect.github.com/usualoma) in [https://github.com/honojs/hono/pull/3414](https://redirect.github.com/honojs/hono/pull/3414) - fix(serve-static): use application/octet-stream if the mime type is not detected by [@usualoma](https://redirect.github.com/usualoma) in [https://github.com/honojs/hono/pull/3415](https://redirect.github.com/honojs/hono/pull/3415) **Full Changelog**: https://github.com/honojs/hono/compare/v4.6.1...v4.6.2 ### [`v4.6.1`](https://redirect.github.com/honojs/hono/releases/tag/v4.6.1) [Compare Source](https://redirect.github.com/honojs/hono/compare/v4.6.0...v4.6.1) #### What's Changed - fix(build): improve addExtension esbuild plugin by [@kt3k](https://redirect.github.com/kt3k) in [https://github.com/honojs/hono/pull/3405](https://redirect.github.com/honojs/hono/pull/3405) #### New Contributors - [@kt3k](https://redirect.github.com/kt3k) made their first contribution in [https://github.com/honojs/hono/pull/3405](https://redirect.github.com/honojs/hono/pull/3405) **Full Changelog**: https://github.com/honojs/hono/compare/v4.6.0...v4.6.1 ### [`v4.6.0`](https://redirect.github.com/honojs/hono/releases/tag/v4.6.0) [Compare Source](https://redirect.github.com/honojs/hono/compare/v4.5.11...v4.6.0) Hono v4.6.0 is now available! One of the highlights of this release is the **Context Storage Middleware**. Let's introduce it. #### Context Storage Middleware Many users may have been waiting for this feature. The [**Context Storage Middleware**](https://hono.dev/docs/middleware/builtin/context-storage) uses `AsyncLocalStorage` to allow handling of the current Context object even outside of handlers. For example, let’s define a Hono app with a variable `message: string`. ```ts type Env = { Variables: { message: string } } const app = new Hono