Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
知っててうれしい HTTP Cookie について
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
greendrop
December 12, 2024
Technology
300
0
Share
知っててうれしい HTTP Cookie について
greendrop
December 12, 2024
More Decks by greendrop
See All by greendrop
gh skill コマンドで AI エージェントのスキルを一元管理・自動配布する
greendrop
0
32
GitHub Actions の設定を少しよくする
greendrop
0
39
リンクからモバイルアプリを起動する技術
greendrop
0
22
知っててうれしい SQL について
greendrop
0
310
知っててうれしい HTTP Cookie を使ったセッション管理について
greendrop
1
300
知っててうれしいリレーショナルデータベースについて
greendrop
0
260
スマホアプリエンジニアでない方へ向けた、スマホアプリ開発に関連するトピック
greendrop
0
230
知っててうれしい HTTP について
greendrop
0
320
知っててうれしい HTTP キャッシュについて
greendrop
0
360
Other Decks in Technology
See All in Technology
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
15
100k
オライリーイベント登壇資料「鉄リサイクル・産廃業界におけるAI技術実応用のカタチ」
takarasawa_
0
420
"スキルファースト"で作る、AIの自走環境
subroh0508
0
630
SpeechTranscriber + AIによる文字起こし機能
kazuki1220
0
120
TypeScriptで実現する既存APIを活用したリモートMCPサーバー構築 / TSKaigi 2026
soarteclab
0
140
GitHub Copilot CLI で考える複数エージェント設計
tomokusaba
0
130
コーディングエージェントはTypeScriptの 型エラーをどう自己修正しているのか
melonps
2
200
How to learn AWS Well-Architected with AWS BuilderCards: Security Edition
coosuke
PRO
0
180
分断された OT と IT を繋ぐ架け橋 -Kubernetes が切り拓く 産業用組み込み製品の現在地 -
yudaiono
1
130
Gaussian Splattingの実用化 - 映像制作への展開
gpuunite_official
0
200
実例から学ぶ GuardDuty(SSH BruteForce)調査の全体フローと勘所【SecurityJAWS】
cscengineer
PRO
0
150
GCASアップデート(202603-202605)
techniczna
0
230
Featured
See All Featured
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
170
New Earth Scene 8
popppiees
3
2.2k
Chasing Engaging Ingredients in Design
codingconduct
0
190
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
530
Claude Code のすすめ
schroneko
67
220k
BBQ
matthewcrist
89
10k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
240
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
330
Building Applications with DynamoDB
mza
96
7k
Art, The Web, and Tiny UX
lynnandtonic
304
21k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
210
Transcript
知っててうれしい HTTP Cookie について 2024/12/12 1
目次 HTTP Cookie とは Cookie の作成 Cookie の更新 Cookie の削除
Cookie の容量 Cookie のセキュリティ まとめ 2
HTTP Cookie とは HTTP Cookie は、Web サーバーからクライアントに送信される情報 を保存する仕組みです。 Web サーバーは、クライアントに対して
Cookie を送信し、クライア ントは Cookie を保存して、次回以降の通信で Cookie を送信します。 HTTP Cookie とは 3
Cookie の作成 Cookie は、レスポンスヘッダーの Set-Cookie で作成します。 HTTP/1.1 200 OK Content-Type:
text/html Set-Cookie: name1=value1 Set-Cookie: name2=value2 Cookie の作成 4
Cookie の更新 Cookie を保持している状態でリクエストを送信し、レスポンスヘッダーの Set-Cookie で Cookie を更新します。 リクエスト GET
/index.html HTTP/1.1 Host: example.com Cookie: name1=value1; name2=value2 レスポンス HTTP/1.1 200 OK Content-Type: text/html Set-Cookie: name1=value3 Set-Cookie: name2=value4 Cookie の更新 5
Cookie の削除 Cookie を削除するには、Cookie の有効期限を過去の日時に設定しま す。 HTTP/1.1 200 OK Content-Type:
text/html Set-Cookie: name1=; expires=Thu, 01 Jan 1970 00:00:00 GMT Cookie の削除 6
Cookie の容量 Cookie の容量は、1 Cookie あたり 4 KB までとされています。 Cookie
は、リクエストに含まれるため、Cookie の容量が大きいと通 信量が増加します。 Cookie の容量 7
Cookie のセキュリティ Cookie は、クライアントとサーバーの通信において平文で送信される ため、Cookie にはセキュリティ上のリスクがあります。 Cookie の設定を適切に行い、セキュリティを確保する必要がありま す。 Cookie
のセキュリティ 8
Cookie 送信先の設定 Cookie は、ドメイン、パスで送信先を設定することで、対象外のドメ イン・パスに Cookie が送信されるのを防ぐことができます。 domain でドメインを指定 path
でパスを指定 HTTP/1.1 200 OK Content-Type: text/html Set-Cookie: name=value; domain=example.com; path=/ Cookie のセキュリティ - 送信先の制限 9
Cookie Secure 属性, HttpOnly 属性 Cookie には、Secure 属性、HttpOnly 属性を設定することで、意図し ない第三者やスクリプトからアクセスされないようにできます。
Secure 属性: HTTPS 通信の場合のみ Cookie を送信 HttpOnly 属性: JavaScript から Cookie にアクセスできない HTTP/1.1 200 OK Content-Type: text/html Set-Cookie: name=value; Secure; HttpOnly Cookie のセキュリティ - Secure 属性, HttpOnly 属性 10
Cookie SameSite 属性 Cookie には、SameSite 属性を設定することで、サードパーティ Cookie の 送信を制御できます。 Strict
: 発行元のサイトにのみ Cookie を送信 Lax : 発行元のサイトにのみ Cookie を送信( 別サイトから移動時も含む) None : サードパーティ Cookie の送信を許可 HTTP/1.1 200 OK Content-Type: text/html Set-Cookie: name=value; SameSite=Strict Cookie のセキュリティ - SameSite 属性 11
まとめ HTTP Cookie は、Web サーバーからクライアントに送信される情 報を保存する仕組み Cookie は、レスポンスヘッダーの Set-Cookie で作成・更新・削除
Cookie は、リクエストに含まれるため、Cookie の容量が大きいと 通信量が増加 Cookie は、セキュリティ上のリスクがあるため、適切な設定が必 要 まとめ 12
ご清聴ありがとうございました。 13