Why AI tools produce this: AI coding tools generate this anti-pattern by default, it appears in a large share of AI-written auth code.
Why this matters
setSecure(false) lets the cookie travel over plain HTTP, and setHttpOnly(false) makes it readable from JavaScript. Either way a session or auth cookie can be intercepted or stolen (CWE-614). This is a common AI-generated mistake where the flag is set to false to "make it work" over localhost and never switched back.
Set cookie.setSecure(true) and cookie.setHttpOnly(true) on every session or authentication cookie, and add SameSite (e.g. Strict or Lax) to further limit cross-site exposure.
If a finding is a genuine false positive, scope the suppression to the exact line and leave a reason, never disable the rule project-wide. Disable directives are line-scoped by design.