官方的 MASTR 标志 MASTR 支持这项工作
目录
← 知识库首页

Web 基础

Cookies: how a website remembers a session

Authentication can depend on a small browser-held identifier rather than a repeated password entry.

Web2 foundation · 1 min read

研究文章和参考条目以英语发布。导航提供七种语言。

本文目录
  1. What travels with a request
  2. The application still decides
  3. 来源与原始文件

What travels with a request

A server can set a cookie that the browser stores and sends with matching later requests. Cookies can support sessions, preferences and other application state. A session cookie often identifies server-held account state rather than containing the password itself.

Cookie attributes affect handling. Secure restricts transmission to secure connections; HttpOnly blocks ordinary script access to the cookie; SameSite influences when it accompanies cross-site requests. These controls address different paths and are not interchangeable.

The application still decides

An application must associate the identifier with the correct account, expire it and invalidate it when appropriate. Protecting the password is insufficient if a stolen valid session can continue making authorised requests.

For users, a password change and an option to revoke other sessions can have different effects. Consult the service's account controls after a suspected compromise. For reviewers, inspect session creation, renewal and termination, not just the login form. Follow session theft and browser origin boundaries for the surrounding controls.

来源与原始文件

相关阅读

MASTR

支持独立研究

这里的调查、原始证据和指南均可免费阅读。自愿捐赠帮助支付研究成本,让 MASTR 能够继续提供工具。

打开钱包