hono
4.13.19 · 16 Nov 2026MIT114.5M / weekRepositoryHomepagenpmAtom feed
4.13.19 is the newest release of 4.x.
In short
5 breaking32 new1 faster20 fixed27 changed26 internal
- Breaking
This major update includes some breaking changes and the addition of three major features.
- Breaking
Validator throws error rathar than return
c.json()- #2021 - Breaking
There are several breaking changes.
- Breaking
Remove deprecated features
- Breaking
Validator throws error rathar than
return c.json()
Security
47 advisories affect 4.0.0; 4.13.16 fixes them
- Highhono: CORS Middleware reflects any Origin with credentials when `origin` defaults to the wildcardGHSA-88fw-hqm2-52qc · 16 Jun 2026Fixed in 4.12.25
- HighHono vulnerable to arbitrary file access via serveStatic vulnerability GHSA-q5qw-h33p-qvwr · 4 Mar 2026Fixed in 4.12.4
- HighHono JWK Auth Middleware has JWT algorithm confusion when JWK lacks "alg" (untrusted header.alg fallback)GHSA-3vhc-576x-3qv4 · 13 Jan 2026Fixed in 4.11.4
- HighHono JWT Middleware's JWT Algorithm Confusion via Unsafe Default (HS256) Allows Token Forgery and Auth BypassGHSA-f67f-6cw9-8mq4 · 13 Jan 2026Fixed in 4.11.4
- HighHono Improper Authorization vulnerabilityGHSA-m732-5p4w-x69g · 22 Oct 2025Fixed in 4.10.2
42 more
- ModerateHono: `csrf()` does not check requests sent by hyperlink auditing (`text/ping`)GHSA-46wx-v44x-9hh2 · 12 Nov 2026Fixed in 4.13.16
- ModerateHono: `mount()` and `app.mount()` can forward a path that bypasses middleware scoped inside the mount prefixGHSA-4m76-xfj5-7975 · 12 Nov 2026Fixed in 4.13.16
- Moderatehono/jsx renders plain strings unescaped in boundary components, leading to XSSGHSA-hxh3-vqpv-xpqv · 30 Sep 2026Fixed in 4.13.7
- ModerateHono: Incomplete fix for CVE-2026-39408: `toSSG()` still writes files outside the output directoryGHSA-gqvv-2mrq-wpjv · 8 Sep 2026Fixed in 4.13.5
- ModerateHono: Unbounded dot-notation nesting in `parseBody()` can cause memory exhaustionGHSA-g6gw-c38x-mqfc · 8 Sep 2026Fixed in 4.13.5
- ModerateHono: Query parser reads parameters after the URL fragment, causing cache-key and proxy interpretation differentialsGHSA-crvj-82cr-hjcx · 8 Sep 2026Fixed in 4.13.5
- ModerateHono: `memo()` retains SSR output across requests, leading to cross-user data disclosureGHSA-f23p-vx2j-j53r · 7 Aug 2026Fixed in 4.12.34
- ModerateHono: ReDoS in CORS middleware via Access-Control-Request-HeadersGHSA-8j4g-w8fx-2239 · 3 Aug 2026Fixed in 4.12.34
- ModerateHono: Server-Side XSS via JSX Escaping Bypass in cx() UtilityGHSA-w62v-xxxg-mg59 · 21 Jul 2026Fixed in 4.12.27
- Moderatehono: Body Limit Middleware can be bypassed on AWS Lambda by understating `Content-Length`GHSA-rv63-4mwf-qqc2 · 16 Jun 2026Fixed in 4.12.25
- Moderatehono: Lambda@Edge adapter keeps only the last value of a repeated request header, dropping the restGHSA-wgpf-jwqj-8h8p · 16 Jun 2026Fixed in 4.12.25
- Moderatehono: Path traversal in `serve-static` on Windows via encoded backslash (`%5C`)GHSA-wwfh-h76j-fc44 · 16 Jun 2026Fixed in 4.12.25
- Moderatehono: AWS Lambda adapter merges multiple `Set-Cookie` headers into one value, dropping cookies on ALB single-header and LatticeGHSA-j6c9-x7qj-28xf · 16 Jun 2026Fixed in 4.12.25
- ModerateHono: app.mount() strips mount prefix using undecoded path, causing incorrect routing for percent-encoded pathsGHSA-2gcr-mfcq-wcc3 · 4 Jun 2026Fixed in 4.12.21
- ModerateHono: IP Restriction bypasses static deny rules for non-canonical IPv6 GHSA-xrhx-7g5j-rcj5 · 4 Jun 2026Fixed in 4.12.21
- ModerateHono: Cookie helper does not sanitize sameSite and priority, allowing Set-Cookie injectionGHSA-3hrh-pfw6-9m5x · 4 Jun 2026Fixed in 4.12.21
- ModerateHono: JWT middleware accepts any Authorization scheme, not only BearerGHSA-f577-qrjj-4474 · 4 Jun 2026Fixed in 4.12.21
- ModerateHono has CSS Declaration Injection via Style Object Values in JSX SSRGHSA-qp7p-654g-cw7p · 9 May 2026Fixed in 4.12.18
- ModerateHono's Cache Middleware ignores Vary: Authorization / Vary: Cookie leading to cross-user cache leakageGHSA-p77w-8qqv-26rm · 9 May 2026Fixed in 4.12.18
- ModerateHono: bodyLimit() can be bypassed for chunked / unknown-length requestsGHSA-9vqf-7f2p-gf9v · 6 May 2026Fixed in 4.12.16
- Moderatehono/jsx has Unvalidated JSX Tag Names that May Allow HTML InjectionGHSA-69xw-7hcm-h432 · 6 May 2026Fixed in 4.12.16
- Moderatehono Improperly Handles JSX Attribute Names Allows HTML Injection in hono/jsx SSRGHSA-458j-xx4x-4375 · 16 Apr 2026Fixed in 4.12.14
- ModerateHono: Non-breaking space prefix bypass in cookie name handling in getCookie()GHSA-r5rp-j6wh-rvv4 · 8 Apr 2026Fixed in 4.12.12
- ModerateHono has incorrect IP matching in ipRestriction() for IPv4-mapped IPv6 addressesGHSA-xpcf-pg52-r92g · 8 Apr 2026Fixed in 4.12.12
- ModerateHono missing validation of cookie name on write path in setCookie()GHSA-26pp-8wgv-hjvm · 8 Apr 2026Fixed in 4.12.12
- ModerateHono: Path traversal in toSSG() allows writing files outside the output directoryGHSA-xf4j-xp2r-rqqx · 8 Apr 2026Fixed in 4.12.12
- ModerateHono: Middleware bypass via repeated slashes in serveStaticGHSA-wmmm-f939-6g9c · 8 Apr 2026Fixed in 4.12.12
- ModerateHono vulnerable to Prototype Pollution possible through __proto__ key allowed in parseBody({ dot: true })GHSA-v8w9-8mx6-g223 · 11 Mar 2026Fixed in 4.12.7
- ModerateHono Vulnerable to Cookie Attribute Injection via Unsanitized domain and path in setCookie()GHSA-5pq2-9x2x-5p6w · 4 Mar 2026Fixed in 4.12.4
- ModerateHono Vulnerable to SSE Control Field Injection via CR/LF in writeSSE()GHSA-p6xx-57qc-3wxr · 4 Mar 2026Fixed in 4.12.4
- ModerateHono vulnerable to XSS through ErrorBoundary component GHSA-9r54-q6cx-xmh5 · 28 Jan 2026Fixed in 4.11.7
- ModerateHono has an Arbitrary Key Read in Serve static Middleware (Cloudflare Workers Adapter)GHSA-w332-q679-j88p · 27 Jan 2026Fixed in 4.11.7
- ModerateHono cache middleware ignores "Cache-Control: private" leading to Web Cache DeceptionGHSA-6wqw-2p9w-4vw4 · 27 Jan 2026Fixed in 4.11.7
- ModerateHono IPv4 address validation bypass in IP Restriction Middleware allows IP spoofingGHSA-r354-f388-2fhh · 27 Jan 2026Fixed in 4.11.7
- ModerateHono vulnerable to Vary Header Injection leading to potential CORS BypassGHSA-q7jf-gf43-6x6p · 24 Oct 2025Fixed in 4.10.3
- ModerateHono has Body Limit Middleware BypassGHSA-92vj-g62v-jqhh · 12 Sep 2025Fixed in 4.9.7
- ModerateHono allows bypass of CSRF Middleware by a request without Content-Type header.GHSA-2234-fmw7-43wr · 15 Oct 2024Fixed in 4.6.5
- ModerateHono vulnerable to Restricted Directory Traversal in serveStatic with denoGHSA-3mpf-rcc7-5347 · 23 Apr 2024Fixed in 4.2.7
- LowHono: `css` helper does not escape a closing tag split between the template and an interpolated value, allowing HTML injectionGHSA-3gg2-335m-rxc6 · 12 Nov 2026Fixed in 4.13.16
- LowHono has improper validation of NumericDate claims (exp, nbf, iat) in JWT verify()GHSA-hm8q-7f3q-5f36 · 9 May 2026Fixed in 4.12.18
- LowHono added timing comparison hardening in basicAuth and bearerAuthGHSA-gq3j-xvxp-8hrf · 19 Feb 2026Fixed in 4.11.10
- LowHono CSRF middleware can be bypassed using crafted Content-Type headerGHSA-rpfr-3m35-5vx5 · 22 Aug 2024Fixed in 4.5.8
Release note
Going to full-stack.
Hono v4.0.0 is out! This major update includes some breaking changes and the addition of three major features.
Static Site Generation
Client Components
File-based Routing
So Hono is going to full-stack. Let's take a look at the three features.
1. Static Site Generation
We introduce SSG Helper. With it you can generate static pages of your Hono applications.
To use this, create a separate file build.ts from the application and call the toSSG() function in it.
import fs from 'node:fs/promises'
import { toSSG } from 'hono/ssg'
import app from './src/index'
toSSG(app, fs)There are adapters for Bun and Deno, so you can write shorter for Bun, for example.
import { toSSG } from 'hono/bun'
import app from './src/index'
toSSG(app)And, just run it.
bun ./build.ts
Then HTML is generated.
$ ls static about.html index.html
You can easily deploy this page to Cloudflare Pages, etc.
$ wrangler pages deploy static
With Vite
We have created a plugin @hono/vite-ssg for Vite. By using this, you will be able to develop and build a static sites with just the vite command.
The configuration is the following:
import build from '@hono/vite-ssg'
import devServer from '@hono/vite-dev-server'
import { defineConfig } from 'vite'
export default defineConfig({
plugins: [
build(),
devServer({
entry: 'src/index.tsx'
})
]
})If you want to develope, just run the command:
vite
If you want to build, just run the command:
vite build
In combination with the deployment mentioned above to Cloudflare Pages, you can develop, SSG build, and deploy non-stop. And each of them is extremely fast (the video is 2x faster).
Screen cast
2. Client Components
hono/jsx was originally designed to run server-side as an alternative to template engines such as Mustache. Server-side JSX is an interesting experiment, creating a new stack to combine with HTMX and Alpine.js. But that's not all.
Now, hono/jsx runs on the client as well. We call it hono/jsx/dom or Client Components.
The exact same code as React runs with Hono's JSX.
import { useState } from 'hono/jsx'
import { render } from 'hono/jsx/dom'
function Counter() {
const [count, setCount] = useState(0)
return (
<div>
<p>Count: {count}</p>
<button onClick={() => setCount(count + 1)}>Increment</button>
</div>
)
}
function App() {
return (
<html>
<body>
<Counter />
</body>
</html>
)
}
const root = document.getElementById('root')
render(<App />, root)The Hooks listed below are also implemented and you can create Client Components just like in React.
useContext
useEffect
useState
useCallback
Use
startTransition
useDeferredValue
useMemo
useLayoutEffect
Memo
isValidElement
startViewTransition family
In addition, the original APIs, startViewTransition family make the View Transition API easy to use.
import { useState, startViewTransition } from 'hono/jsx'
import { Style, css, keyframes } from 'hono/css'
const fadeIn = keyframes`
from { opacity: 0; }
to { opacity: 1; }
`
const App = () => {
const [showTitleImage, setShowTitleImage] = useState(false)
return (
<>
<button onClick={() => startViewTransition(() => setShowTitleImage((state) => !state))}>Click!</button>
<div>
{!showTitleImage ? (
<img src="https://hono.dev/images/logo.png" />
) : (
<div
class={css`
animation: ${fadeIn} 1s;
background: url('https://hono.dev/images/logo-large.png');
background-size: contain;
background-repeat: no-repeat;
background-position: center;
width: 500px;
height: 200px;
`}
/>
)}
</div>
</>
)
}You can easily create the animation.
SC
Ultra-small
The hono/jsx/dom is fast and ultra-small. It has a smaller JSX runtime dedicated to the DOM in addition to the common server and client ones. Just specify hono/jsx/dom instead of hono/jsx in tsconfig.json.
"jsx": "react-jsx", "jsxImportSource": "hono/jsx/dom"
The above counter example is 2.8KB with Brotli compression.
SS
In comparison, React is 47.3 KB for the same thing.
SS
3. File-based Routing
Last is File-based Routing. This is not included in the hono package, but is provided in a separate package.
It is named HonoX.
HonoX
HonoX has the following features.
File-based routing - You can create a large application like Next.js.
Fast SSR - Rendering is ultra-fast thanks to Hono.
BYOR - You can bring your own renderer, not only one using hono/jsx.
Islands hydration - If you want interactions, create an island. JavaScript is hydrated only for it.
Middleware - It works as Hono, so you can use a lot of Hono's middleware.
You can try it now. One of create-hono's starter templates named "x-base" uses HonoX.
For detailed usage, please see the following HonoX repository.
The core is still tiny
The addition of this feature has no impact on the core. "Hello World" in hono/tiny is still small, only 12KB minified.
Other new features
base: Set Default Path to
'*'forapp.use()- #1753hono-base:
app.onsupports multiple paths - #1923css: Introduce pseudo global selector and class name based extend syntax - #1928
jsx-renderer: Nested Layouts via Renderer - #1945
- Breaking
Validator throws error rathar than return
c.json()- #2021 Introduce Accepts Helper - #2001
serve-static:
mimesoption for serve-static - #2094Feat!(validator): supports transformation - #2130
Breaking Changes
There are several breaking changes. Please see the Migration Guide below.
github.com/honojs/hono/blob/main/docs/MIGRATION…
All Updates
base: Set Default Path to '*' for app.use()
Introduce jsx/dom
hono-base:
app.onsupports multiple paths- Breaking
Remove deprecated features
jsx/dom: Fix cleanup for deps
css: Introduce pseudo global selector and class name based extend syntax
Introducing a New SSG Adaptor/Helper
factory: Remove
deprecatedfromFactoryandcreateHandlersssg: Fix path parser bug & refactor code
ssg: Implement Dynamic File Extension on MIME Type and Enhanced Response Handling
jsx/dom: Rewrite renderer to use virtual tree
Feat!(cloudflare-workers): make
manifestrequiredjsx/dom: Provide jsx-runtime and jsx-dev-runtime via jsx/dom
types: Correct
c.get()inferencejsx/dom: startTransition() and useTransition()
ssg: Ignore Dynamic Route
Added
ssgParamsmiddlewaressg: Fixed
isDynamicRouteandssgParamsmatterjsx/dom: Support createContext and useContext in jsx/dom
jsx/dom: Find "insertBefore" node from next node list if not found
- Breaking
Validator throws error rathar than
return c.json() Feat!(deno): move middleware to helper
SSG: Correct extension of the file output
jsx/dom: Introduce startViewTransition()
ssg: Remove ArrayBuffer from FileSystemModule's writeFile
Introduce Accepts Helper
Improve
ssgParamsflexibilitydeno: Export accpet helper for deno
Fix!(types): Fix context type when chaining routes with middlewares
Use DOCTYPE by default
ssg: Uniformly Convert Paths Ending with Slash to 'index.ext' Format
Introduce
useViewTransition()hook andviewTransition()helperssg: Support Improve Hook Handling
Await generate hook
fix:(ssg): make 'files' mandatory in ToSSGResult
types: Explicitly specify statusCode
goodbye: Lagon
Add typesVersions of accepts helper
serve-static:
mimesoption for serve-staticssg: Introduce
disableSSGandonlySSGFeat!(mime): reduce default mimes
types: Better
c.vartypejsx-renderer: Correct nested layouts
Feat!(validator): supports transformation
jsx/dom: More react staff
html: Remove circular dependencies in
hono/htmlMerge main into v4
jsx: "className" is now an alias for "class"
Fix!(deno): put SSG helper into
helper.tstypes:
MergeSchemePathinfers param types correctlytypes:
MergeSchemaPathinfer inputs not only paramsFix/function for attribute
jsx: The third argument of jsx(), key, is optional
Feat/more jsx event
mime: Make
getExtension()fastv4
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.