Insecure Cookie (ARCH5123)
هذا المحتوى غير متوفر بلغتك بعد.
Key go.security.insecure-cookie · Severity warning · Category security · CWE CWE-614
Cookies without the Secure flag are also sent over unencrypted HTTP connections. This lets a network attacker capture the session cookie in cleartext.
Incorrect
Section titled “Incorrect”http.SetCookie(w, &http.Cookie{ Name: "session", Value: token, HttpOnly: true,})Correct
Section titled “Correct”http.SetCookie(w, &http.Cookie{ Name: "session", Value: token, HttpOnly: true, Secure: true, SameSite: http.SameSiteLaxMode,})Set sensitive cookies with Secure: true so they are only transmitted over HTTPS.