Skip to content
vetkitChecksChangelogDocumentationBlogComparisons

Java session cookie missing the HttpOnly flag

Rule ID: vetkit.java.cookie.missing-httponly

A session or authentication cookie is sent without the HttpOnly flag, so script injected into the page can read it.

Last updated:

Suite: Security

java

A session or authentication cookie is sent without the HttpOnly flag, so script injected into the page can read it.

Category: SECURITY · Engine rule severity: INFO

How to fix it

Call setHttpOnly(true) (and setSecure(true) behind HTTPS) before addCookie, pass httpOnly=true to NewCookie, or configure <cookie-config><http-only>true</http-only></cookie-config> for the session cookie.

References

Source: packages/engine/rules/sast/java.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.