本文へスキップ
Skillpedia
セキュリティ75k · #3017

session-cookie-flags

できること

このスキルは、ログイン状態を保つCookieを確認し、それらを守るセキュリティのフラグを設定します。認証やサーバーの設定を管理する開発者向けです。

使う場面

  • ✓ログインやセッションのシステムが設定しているCookieを確認するようエージェントに頼むとき。
  • ✓サイトがセキュリティのフラグなしでセッションのCookieを設定しているとき。
  • ✓認証のミドルウェアを追加していて、最初からCookieを安全に設定したいとき。

スキルのリンク

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/session-cookie-flags/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/session-cookie-flags/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“私のログインシステムが設定するセッションのCookieを確認して、Secure、HttpOnly、SameSiteのフラグを追加してください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントは、Set-Cookieヘッダーと、Cookieを作成するコードを確認します。Secureを追加してHTTPSでのみ送られるようにし、HttpOnlyを追加してスクリプトが読めないようにし、SameSiteをStrictかLaxに設定してサイトをまたぐ要求を制限します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Set Secure, HttpOnly, and SameSite flags on session cookies

Missing cookie flags are one of the most common and easily fixed authentication weaknesses. Without Secure, session tokens are transmitted in plain text over HTTP and can be captured by network eavesdroppers. Without HttpOnly, any XSS payload can exfiltrate the session token in one line. Without SameSite, any website can trigger authenticated actions on behalf of the victim without their knowledge.

Quick Reference

  • Secure — cookie is only sent over HTTPS, never plain HTTP
  • HttpOnly — cookie is invisible to JavaScript (blocks XSS theft)
  • SameSite=Strict or Lax — prevents the cookie from being sent on cross-site requests (blocks CSRF)
  • Never use SameSite=None without also setting Secure and understanding the CSRF implications

Check

Check whether session and authentication cookies are set with the Secure, HttpOnly, and SameSite flags.

Fix

Update the server's cookie configuration to include Secure, HttpOnly, and SameSite=Strict (or Lax) on all session and auth cookies.

Explain

Explain what each cookie security flag does and the specific attack each one prevents.

Code Review

Review all Set-Cookie headers and cookie creation code. Flag any cookies missing the HttpOnly flag, absent Secure flag, or an unspecified or overly permissive SameSite setting.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/security/session-cookie-flags

よくある質問

HttpOnlyは何から守りますか?

このスキルによると、JavaScriptからCookieを隠すため、多くのクロスサイトスクリプティングの攻撃によるセッションの盗難を防ぎます。

SameSiteは何から守りますか?

このスキルによると、サイトをまたぐ要求でCookieが送られないようにし、クロスサイトリクエストフォージェリを防ぐのに役立ちます。

SameSite Noneが許されるのはいつですか?

このスキルによると、Secureも設定されていて、サイトをまたぐ要求のリスクを理解している場合に限ります。

詳細

作者による元の説明

Use when reviewing server-side session management, setting up authentication middleware, or auditing cookie configuration in HTTP response headers.

repo: thedaviddias/Front-End-Checklist

人気

GitHubのスター
75k
ランキング
#3017
ライセンス
MIT
更新日
2026/10/31

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル