Packages

hono

4.13.19 · 16 Nov 2026MIT113.6M / weekRepositoryHomepagenpmAtom feed

Your version

2.3.0

19 Oct 2022Where it was published

2.7.8 is the newest release of 2.x.

In short

3 breaking1 security2 new2 faster3 fixed2 internal

  • Breaking

    This release includes SECURITY UPDATE and associated BREAKING CHANGES.

  • Breaking

    Targets: "Basic Auth Middleware" and "Bearer Auth Middleware".

  • Breaking

    With it, there is Breaking Change.

  • Security

    Vulnerability detail: Even if "unauthorized", the Handler will be executed.

Security

44 advisories affect 2.3.0; 4.13.16 fixes them

39 more

Release note

Security update & Breaking change

This release includes SECURITY UPDATE and associated BREAKING CHANGES.

  • Breaking

    Targets: "Basic Auth Middleware" and "Bearer Auth Middleware".

  • Security

    Vulnerability detail: Even if "unauthorized", the Handler will be executed.

If you are using an older version of Basic Auth Middleware and Bearer Auth Middleware, please use this version. See the release notes on GitHub for version updates.

With it, there is Breaking Change.

If you are using Basic Auth and Bearer Auth in your Handler (nested), change as follows:

app.use('/auth/*', async (c, next) => {
  const auth = basicAuth({ username: c.env.USERNAME, password: c.env.PASSWORD })
  return auth(c, next) // Older: `await auth(c, next)`
})

New features

Validator Middleware supports nested validation

For example, there is a nested object like below:

const data = {
  posts: [
    {
      id: 123,
      title: 'JavaScript',
      tags: ['Workers', 'Deno', 'Bun'],
    },
  ],
  pager: {
    prev: true,
    next: false,
  },
}

It will be validated with v.array() and v.object():

app.post(
  '/posts',
  validator((v) => ({
    posts: v.array('posts', (v) => ({
      id: v.json('id').asNumber().isRequired(),
      title: v.json('title'),
      tags: v.json('tags').asArray(),
    })),
    pager: v.object('pager', (v) => ({
      prev: v.json('prev').asBoolean(),
      next: v.json('next').asBoolean(),
    })),
  })),
  (c) => {
    return c.text('Valid!')
  }
)

And it also has types:

Isn't it cool?

Validator Middleware supports friendly error messages

For example, an error message will become more friendly.

'Invalid Value: the request body "title" is invalid - abcdefg'

will be:

'Invalid Value [abcdef]: the request body "title" is invalid - isLength'

All updates

  • Remove unrequired cloning of ctx.res

  • deno: Fixed the bug calling next() multiple times in Serve Static

  • serve-static: Return immediately if c.finalized

  • validator: Introduce nested validation

  • validator: Has the error message per rule

  • bearer-auth, basic-auth: Handler should not be executed when unauthorized

  • basic/bearer: Support "nested" middleware

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.