H3 · Security

H30017Use a session password of at least 32 characters

Flags a literal password shorter than 32 characters in session calls that can seal a session.

Why it happens

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

Fix

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 })
})

Verify the fix

Run only this rule after editing so the report stays focused on the diagnostic you are closing:

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