H3 · H30017

Use a session password of at least 32 characters

Flags a literal password shorter than 32 characters in session calls that can seal a session.
H30017vite-doctor/h3securityerrorSuggestion

Run this rule

pnpm vite-doctor . --rules h3/security/session-password-too-short

Why it matters

When H3 seals a session, iron-webcrypto rejects short passwords with "Password string too short". Reading an existing session does not necessarily seal it.

Read a secret of at least 32 characters from runtime configuration or an environment variable instead of a literal.

Example

Read the session password from the environment

Before

export default defineHandler((event) => {
  return useSession(event, { password: "dev-secret" })
})

After

export default defineHandler((event) => {
  return useSession(event, { password: process.env.SESSION_PASSWORD })
})
Copyright © 2026