Cookie Missing HttpOnly (ARCH6124)
Esta página aún no está disponible en tu idioma.
Key ruby.security.cookie-missing-httponly · Severity warning · Category security · CWE CWE-1004
Cookies without the HttpOnly flag are readable by JavaScript, so an XSS flaw can steal them. Always set HttpOnly on session and auth cookies.
Incorrect
Section titled “Incorrect”class SessionsController < ApplicationController def create cookies[:session_token] = { value: token } endendCorrect
Section titled “Correct”class SessionsController < ApplicationController def create cookies[:session_token] = { value: token, httponly: true, secure: true, same_site: :lax } endendSet session and auth cookies with httponly: true.