7. 通常のWebサーバとの通信 <html> <body> <form action=“register” method=“POST”> 氏名:vultest<BR> メールアドレス:vultest@example.jp<BR> 性別:男<BR> (以下略) </html> POST /confirm.php HTTP/1.1 Host: example.jp (以下略) Cookie: PHPSESSID=xxxxxxxxxx name=vultest&mail=vultest%40example.jp&gender=1 HTTP Response HTTP Request 8. 色々いじってみてどういう応答があるか確認 POST /confirm.php HTTP/1.1 Host: example.jp (以下略) Cookie: PHPSESSID=xxxxxxxxxx name
あるサイトから別ドメインのクッキーを書き込む。こういうクッキーは、サードパーティクッキーと呼ばれる。FirefoxとChromeはデフォルトでサードパーティクッキーが書き込めるようになっているが、IEとSafariが問題になる。IEはコンパクトポリシーというものを設定すればいけるが、Safariは出来ない。Safariはデフォルトで”知らないとサイトや広告のみCookieをブロック”となっている。でも、GoogleAdsenseとかは書き込めている。なので調べた。 目的 localhostにアクセスしたときsample.comのクッキーを書き込みたい。 もちろんクロスブラウザで。 (sample.comはhosts書き換えやるといい) ポリシーの設定 (P3P) (以下IE対策用) webサイトで個人情報などを取り扱う場合、ブラウザで設定されたポリシー設定とアクセスしているサイトのポリシー
なにげにしらなかったんだけど、IEで別ドメインのiframeを読み込むと、そのiframe内のcookieが有効にならない。 そーゆーときは、HTTPのリクエスト時のヘッダーに下記のkey&valueを出力しておけばOKらしい。 ("P3P", 'CP="CAO PSA OUR"') こーするだけで、あらふしぎ。IEがCookieを保存してくれるじゃん。 ……。 iframeで別ドメインのコンテンツを読み込むと、そのCookieはサードパーティーのCookieとなります。IEのデフォルトでは、ポリシーが定義されていないサードパーティーのCookieは受け入れないようになっていて、P3P (www.w3.org)でポリシーを宣言すれば受け入れられるようになります。 P3Pのポリシーを定義するには、がっつりとXMLを用意する方法もありますが、HTTP応答ヘッダの中に直接書くという方法もあり、コ
WebアプリケーションにおいてJSONを用いてブラウザ - サーバ間でデータのやり取りを行うことはもはや普通のことですが、このときJSON内に第三者に漏れては困る機密情報が含まれる場合は、必ず X-Content-Type-Options: nosniff レスポンスヘッダをつけるようにしましょう(むしろ機密情報かどうかに関わらず、全てのコンテンツにつけるほうがよい。関連:X-Content-Type-Options: nosniff つかわないやつは死ねばいいのに! - 葉っぱ日記)。 例えば、機密情報を含む以下のようなJSON配列を返すリソース(http://example.jp/target.json)があったとします。 [ "secret", "data", "is", "here" ] 攻撃者は罠ページを作成し、以下のようにJSON配列をvbscriptとして読み込みます。もちろ
ちょっと凝ったWebアプリケーションを作成していたり、あるいはWebのセキュリティに関わっている人ならば「Same-Origin Policy」(SOP)という言葉を一度は聞いたことがあると思います。日本語では「同一生成元ポリシー」あるいは「同一生成源ポリシー」などと訳されることもありますが、個人的には「オリジン」は固有の概念を表す語なので下手に訳さず「同一オリジンポリシー」と書いておくのが好きです。 さて、この「オリジン」とは何なのかという話ですが、これは「RFC 6454 - The Web Origin Concept」で定められており、端的に言うと「スキーム、ホスト、ポート」の組み合わせをオリジンと定め、それらが同じものは同一のオリジンとして同じ保護範囲のリソースとして取り扱うということです。 例えば、http://example.jp/fooとhttp://example.jp:
Flash でドメインをまたいで外部ファイルを読み込みたい場合 参照側のサーバー(外部ファイルが置いてある方)に crossdomain.xmlという名前のXMLが必要らしいです。 XMLの書き方は 全てのドメインのアクセスを許可する(どこからでもOK〜!にする)ときは 以下の記述をしたXML「crossdomain.xml」をルートディレクトリに配置 他の全てのドメインから読み込まれるのを防ぐ(他のドメインは全部ダメー!にする)ときは crossdomain.xmlファイルを設置しない! もしくはallow-access-from タグのない crossdomain.xml ファイルをルートディレクトリに配置 crossdomain.xml の各要素の内容 メタポリシー設定 all: すべてのポリシーファイルが許可されます。 by-content-type: Content-Typeがt
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く