تخطَّ إلى المحتوى

Insecure Cookie (ARCH4123)

هذا المحتوى غير متوفر بلغتك بعد.

Key java.security.insecure-cookie · Severity warning · Category security · CWE CWE-614

Cookies without the Secure flag are also sent over unencrypted HTTP, exposing them to network eavesdroppers. Always mark session cookies Secure.

Cookie cookie = new Cookie("SESSION", token);
cookie.setHttpOnly(true);
response.addCookie(cookie); // no Secure -> sent over http too
Cookie cookie = new Cookie("SESSION", token);
cookie.setHttpOnly(true);
cookie.setSecure(true);
response.addCookie(cookie);

Call setSecure(true) on session/auth cookies.