Auth cookie set without httpOnly in Express and Next.js
Rule ID: vetkit.js.session.auth-cookie-without-httponly
A session or auth token cookie is set without httpOnly: true. Express res.cookie, Next.js cookies().set / response.cookies.set and Hono setCookie do not add HttpOnly by default, so any cross-site scripting bug can read the token and take over the session.
Last updated:
Suite: Security
javascript, typescript
A session or auth token cookie is set without httpOnly: true. Express res.cookie, Next.js cookies().set / response.cookies.set and Hono setCookie do not add HttpOnly by default, so any cross-site scripting bug can read the token and take over the session.
Category: SECURITY · Engine rule severity: WARNING
How to fix it
Pass httpOnly: true (with secure: true and sameSite: 'lax' or 'strict') when setting session and token cookies. If the browser needs a value, put only that non-secret value in a separate cookie.
References
Source: packages/engine/rules/sast/javascript.yml.
Related checks
Check your own repository for this
vetkit runs this rule as part of a repository audit, alongside secret scanning, dependency vulnerabilities, code quality and AI code risk checks. It reads a temporary checkout and never executes your code.
Start with the free Security Quick Scan · See how the platform works
Generated from shipped rule definitions at build time. Matching is a review signal, not proof of exploitability. “generic” denotes text matching, not complete language or framework coverage. Runtime configuration and available tools affect whether a rule runs.