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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
greendrop
December 12, 2024
Technology
290
0
Share
知っててうれしい HTTP Cookie について
greendrop
December 12, 2024
More Decks by greendrop
See All by greendrop
GitHub Actions の設定を少しよくする
greendrop
0
32
リンクからモバイルアプリを起動する技術
greendrop
0
17
知っててうれしい SQL について
greendrop
0
300
知っててうれしい HTTP Cookie を使ったセッション管理について
greendrop
1
290
知っててうれしいリレーショナルデータベースについて
greendrop
0
250
スマホアプリエンジニアでない方へ向けた、スマホアプリ開発に関連するトピック
greendrop
0
220
知っててうれしい HTTP について
greendrop
0
320
知っててうれしい HTTP キャッシュについて
greendrop
0
350
知っててうれしいデータベースについて
greendrop
0
300
Other Decks in Technology
See All in Technology
Kubernetes基盤における開発者体験 とセキュリティの両⽴ / Balancing developer experience and security in a Kubernetes-based environment
chmikata
0
220
AIドリブン開発の実践知 ― AI-DLC Unicorn Gym実施から見えた可能性と課題
mixi_engineers
PRO
0
120
サイバーフィジカル社会とは何か / What Is a Cyber-Physical Society?
ks91
PRO
0
160
Oracle AI Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
4
2.2k
インフラを Excel 管理していた組織が 3 ヶ月で IaC 化されるまで
geekplus_tech
3
170
Oracle AI Database@Google Cloud:サービス概要のご紹介
oracle4engineer
PRO
6
1.3k
チームで育てるAI自走環境_20260409
fuktig
0
990
ログ基盤・プラグイン・ダッシュボード、全部整えた。でも最後は人だった。
makikub
5
1.3k
Hello UUID
mimifuwacc
0
130
Cortex Codeでデータの仕事を全部Agenticにやりきろう!
gappy50
0
340
LLM とプロンプトエンジニアリング/チューターを定義する / LLMs and Prompt Engineering, and Defining Tutors
ks91
PRO
0
320
会社紹介資料 / Sansan Company Profile
sansan33
PRO
16
410k
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
77
5.3k
Making the Leap to Tech Lead
cromwellryan
135
9.8k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
27
3.4k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.2k
A designer walks into a library…
pauljervisheath
211
24k
Balancing Empowerment & Direction
lara
5
1k
The Curse of the Amulet
leimatthew05
1
11k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
120
Statistics for Hackers
jakevdp
799
230k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.5k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
150
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
220
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