Insecure Cookie (ARCH7123)
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Key php.security.insecure-cookie · Severity warning · Category security · CWE CWE-614
Cookies without the Secure flag (or with SameSite=None and no Secure) are also sent over unencrypted HTTP, so an attacker eavesdropping on the network can capture the session cookie.
Incorrect
Section titled “Incorrect”<?phpsetcookie('session', $token, [ 'httponly' => true, 'secure' => false, // also sent over HTTP]);Correct
Section titled “Correct”<?phpsetcookie('session', $token, [ 'httponly' => true, 'secure' => true, // HTTPS only 'samesite' => 'Lax',]);Set all session cookies with secure => true so they are only transmitted over an encrypted connection.