An authentication-related cookie is set without the Secure and/or HttpOnly flags (or with SameSite=None).
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
HttpOnly=false exposes the cookie to JavaScript so an XSS bug can steal the session; Secure=false lets it travel over plain HTTP where a network attacker can read it; SameSite=None (without an allowlist) sends it on cross-site requests (CWE-1004). AI-generated snippets pass false for these flags to avoid a "cookie not set" issue during local testing and it ships to production.
Set the security flags on session/auth cookies: setcookie('session_id', $v, ['secure' => true, 'httponly' => true, 'samesite' => 'Lax']); session_set_cookie_params(['lifetime' => 3600, 'secure' => true, 'httponly' => true, 'samesite' => 'Lax']);
Suppressing this rule
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.
// oauthlint-disable-next-line auth.php.cookie.insecure-flags -- <reason>