Cookie Missing HttpOnly (ARCH4124)
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Key java.security.cookie-missing-httponly · Severity warning · Category security · CWE CWE-1004
Session cookies without the HttpOnly flag are readable by JavaScript, allowing cookie theft via XSS. Always mark auth cookies HttpOnly.
Incorrect
Section titled “Incorrect”Cookie cookie = new Cookie("SESSION", token);cookie.setSecure(true);response.addCookie(cookie); // no HttpOnly -> JS can read itCorrect
Section titled “Correct”Cookie cookie = new Cookie("SESSION", token);cookie.setHttpOnly(true);cookie.setSecure(true);response.addCookie(cookie);Call setHttpOnly(true) on session/auth cookies.