[PHP-users 12101] Re: 「他人の情報を表示するサイト」

Yasuo Ohgaki php-users@php.gr.jp
Mon, 09 Dec 2002 11:26:12 +0900


大垣です。

HAYAKAWA Hiroshi wrote:
> 学校や企業等、
> 透過型のキャッシュサーバーが設置されていることも多いようなので、
> キャッシュサーバーの存在を踏まえて
> まずはそこにキャッシュさせないことが重要ではないかと思います。

キャッシュさせないのは重要です。
例えば、squidはcookieの取扱は以下のようになっています。

== from squid FAQ ==
12.19 How does Squid deal with Cookies?

The presence of Cookies headers in requests does not affect
whether or not an HTTP reply can be cached. Similarly, the
presense of Set-Cookie headers in replies does not affect
whether the reply can be cached.

The proper way to deal with Set-Cookie reply headers, according
to RFC 2109 is to cache the whole object, EXCEPT the Set-Cookie
header lines.

With Squid-1.1, we can not filter out specific HTTP headers, so
Squid-1.1 does not cache any response which contains a
Set-Cookie header.

With Squid-2, however, we can filter out specific HTTP headers.
But instead of filtering them on the receiving-side, we filter
them on the sending-side. Thus, Squid-2 does cache replies with
Set-Cookie headers, but it filters out the Set-Cookie header
itself for cache hits.

> つまるところ、
> ・キャッシュサーバーにキャッシュさせない
> ・セッションIDをユニークにする
> ・セッションの期限を短くする
> ・セッションIDそのものがバレないようにする
> ・クライアントブラウザにキャッシュさせない
> ・共有マシンを利用するときはログアウトやブラウザの終了を徹底する
> といったあたりを、
> 背景を理解した上で組み合わせる必要があって、
> いろんな状況・環境や、仕様通りでない実装なども踏まえると、
> 「どれが一つを徹底しただけではダメ」ですね。

その通りですね。
追加としては

・session cookieをできるだけ利用する(期限つきクッキー、trans sidはで
  きるだけ使わない)
・trans sidを利用する場合、少なくとも同じセッションIDを使われ続けないよう
  注意する。
・SSLの利用を検討する(SSLが必要なアプリケーションではブラウザにページが
  キャッシュされSID漏洩を防ぐため、trans sidは使わない)
・SSLでもsession cookieを利用し、secureフラグを立てる。

くらいでしょうか?

--
Yasuo Ohgaki