Complete the code to set a cookie that is only sent over HTTPS.
Set-Cookie: sessionId=abc123; [1]The Secure attribute ensures the cookie is only sent over HTTPS connections, protecting it from being sent over insecure HTTP.
Complete the code to prevent JavaScript from accessing the cookie.
Set-Cookie: userToken=xyz789; [1]The HttpOnly attribute prevents client-side scripts like JavaScript from accessing the cookie, reducing the risk of cross-site scripting attacks.
Fix the error in the cookie attribute to prevent cross-site request forgery.
Set-Cookie: auth=token123; SameSite=[1]The SameSite=Strict attribute restricts the cookie to same-site requests only, helping prevent cross-site request forgery (CSRF) attacks.
Fill both blanks to set a cookie that is secure and inaccessible to JavaScript.
Set-Cookie: id=456def; [1]; [2]
Using both Secure and HttpOnly attributes ensures the cookie is sent only over HTTPS and is not accessible via JavaScript, enhancing security.
Fill all three blanks to create a cookie that is secure, inaccessible to JavaScript, and restricted to same-site requests.
Set-Cookie: token=abc456; [1]; [2]; [3]
Combining Secure, HttpOnly, and SameSite=Strict attributes provides strong protection by ensuring the cookie is sent only over HTTPS, hidden from JavaScript, and restricted to same-site requests.