1. http/cookie

httpのぶ厚い仕様書でCookieがきちんと定義されていなかったのには驚いた。

RFC 6265 HTTP State Management Mechanism https://tools.ietf.org/html/rfc6265

http://blog.lucanian.net/archives/50823597.html

https://secure.wikimedia.org/wikipedia/en/wiki/HTTP_cookie

A cookie, also known as an HTTP cookie, web cookie, or browser cookie,
is used for an origin website to send state information to a user's browser
and for the browser to return the state information to the origin site.[1]

The state information can be used for authentication, identification of a user session,
user's preferences, shopping cart contents, or anything else
that can be accomplished through storing text data on the user's computer.

Cookies are not software.
They cannot be programmed, cannot carry viruses, and cannot install malware on the host computer.[2]
However, they can be used by spyware to track user's browsing activities – 
a major privacy concern that prompted European and US law makers to take action.[3] [4]
Cookies can also be stolen by hackers to gain access to a victim's web account.[5]

1.1. サーバから

サーバからクライアントへSet-Cookie ヘッダを送って、Cookie を設定するように指示する。

Set-Cookie: NAME=VALUE; expires=DATE; path=PATH; domain=DOMAIN_NAME; secure

送られたクッキーのうち、expires属性による有効期限内のクッキーは保存されます。

1.2. クライアントから

クライアントは「条件」にあったCookie ヘッダを送り返す。/送り返す条件

Cookie: NAME1=OPAQUE_STRING1; NAME2=OPAQUE_STRING2; ...

http://blog.tokumaru.org/2011_10_01_archive.html

(サーバは)「クッキーを勝手に改変されることはない」と思うのは間違いだ。

2. 用途

送られたcookieをどう使うかはサーバ次第。

Terminologies

    2.1 Session cookie
    2.2 Persistent cookie  (tracking cookies or in-memory cookies)
    2.3 Secure cookie (used when a browser is visiting a server via HTTPS)
    2.4 HttpOnly cookie (restricting access from other, non-HTTP APIs)
    2.5 Third-party cookie (being set with different domains than the one shown on the address bar)
    2.6 Supercookie
    2.7 Zombie cookie

Most browsers, by default, allow first-party cookies—
a cookie with domain to be the same or sub-domain of the requesting host.
For example, a user visiting www.example.com can have a cookie set with domain www.example.com or
 .example.com, but not .com.

ここのsub-domainという語はDNSでいうsubdomainとは逆の意味で使われているように思う。

http://thinkit.co.jp/free/article/0604/7/8/ ページ間の追跡に使う。


Public Suffix List


“徳丸浩の日記: 都道府県型JPドメインがCookieに及ぼす影響の調査” http://t.co/Ba9vvGs7

それをドメイン名空間のせいにするなら、筋違い。


cookieの扱いに問題がある。(どういう解決が望ましいかは別として)

言うとしたら、HTTPあるいはcookieの欠陥というべきではないか。 -- ToshinoriMaeno 2011-10-01 13:21:21

Public Suffix List を使いたいなら、Mozillaを使えばよい。 IEに求めるのは...

-- ToshinoriMaeno 2011-10-01 14:26:09

http://ockeghem.tumblr.com/post/10925870599/cookie-monster-bug

Cookie Controller, Cookie Manager など

BetterPrivacy というのもある。

https://secure.wikimedia.org/wikipedia/en/wiki/HTTP_cookie#Cookie_theft_and_session_hijacking

2.3. サーバでのcookie管理

特に長期の管理が問題とか。 (HTTPのstate管理とは話が違うぞ。)

徳丸記事: http://www.atmarkit.co.jp/fsecurity/rensai/keitaiweb02/keitaiweb03.html

ぜひCookieを認証やセッション管理に活用することをお勧めします。

携帯の認証というのはそんなにひどいのか。

/毒入りcookie: https://twitter.com/#!/ockeghem/status/128099034975051777

2.4. web とはなにか

欠陥を抱えたまま、推進しているのは誰か。よく考えよう。

(予定)

-- ToshinoriMaeno 2011-10-05 01:38:45

2.6. 解説記事

http://www.futomi.com/lecture/cookie/index.html