What is Cookie (HTTP cookie)?
A small piece of name-value data that a web server has the browser store with the Set-Cookie header. The browser then attaches it automatically in the Cookie header to later requests to the same site. It is often used to hold a session ID so that a login state can be kept over stateless HTTP. Attributes such as Secure (send only over HTTPS), HttpOnly (hide from scripts), SameSite (whether to attach it to requests started from other sites) and Expires/Max-Age (expiry) specify how it is handled.
Japanese name: Cookie
Cookie (HTTP cookie) appears in 6 practice questions across 2 topics, including Web Technology Basics, Information Security Basics.
Field: Web Technology Basics
Attributes for security
With Secure, the cookie is sent only over HTTPS, which keeps its value from being learned by eavesdropping. With HttpOnly, the page's JavaScript cannot read it, which reduces the damage if a session ID would otherwise be stolen through XSS. SameSite specifies, as Strict, Lax or None, whether the cookie is attached to requests started from other sites, and is one of the countermeasures against attacks that make a user send requests they did not intend.
FAQ
What happens if cookies are disabled?
Session IDs can no longer be passed, so many sites cannot keep you logged in. Information remembered in cookies, such as the contents of a shopping cart or display settings, is not kept either.
What are third-party cookies?
They are cookies set by a site other than the page you are viewing, such as a site that serves advertisements. Because they have been used to track users' behavior across many sites, some browsers do not send them by default or restrict them to protect privacy.