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

Cookie Missing HttpOnly (ARCH6124)

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

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.

class SessionsController < ApplicationController
def create
cookies[:session_token] = { value: token }
end
end
class SessionsController < ApplicationController
def create
cookies[:session_token] = {
value: token,
httponly: true,
secure: true,
same_site: :lax
}
end
end

Set session and auth cookies with httponly: true.