H3 · Security
vite-doctor/h3securityerrorSuggestion
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