Ir al contenido

Cookie Missing HttpOnly (ARCH7124)

Esta página aún no está disponible en tu idioma.

Key php.security.cookie-missing-httponly · Severity warning · Category security · CWE CWE-1004

Session/auth cookies without the HttpOnly flag are readable by JavaScript. If an XSS flaw exists, an attacker can steal the session via document.cookie.

<?php
setcookie('session', $token, [
'secure' => true,
'httponly' => false, // readable by JavaScript
]);
<?php
setcookie('session', $token, [
'secure' => true,
'httponly' => true,
'samesite' => 'Lax',
]);

Set all session and auth cookies with httponly => true so client scripts cannot access them.