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.
h3/security/session-password-too-shortsrc/rule-packs/h3/rules/session-password-too-short.ts Upstream docs 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.
Recommended fix
Read a secret of at least 32 characters from runtime configuration or an environment variable instead of a literal.
Useful links
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 })
})