cross-origin-security
できること
このスキルは、サイトがオリジンをまたぐリクエストやメッセージをどう扱うかを確認します。攻撃者がデータを読んだり、利用者の代わりに動いたりするのを止めたい開発者向けです。
使う場面
- ✓サイトが、他のウィンドウやiframeからのメッセージを受け取っているとき。
- ✓CORSの設定が、ログイン後のルートであらゆるオリジンを許可しているとき。
- ✓リダイレクトのパラメーターで、利用者を任意の外部のアドレスに送れるとき。
スキルのリンク
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/cross-origin-security/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“他のサイトがユーザーのデータを読めてしまうおそれがないか、私のサイトのメッセージのリスナーとCORSの設定を確認してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、メッセージのリスナーが各メッセージの送信元を確認しているか、認証されたルートでCORSが制限されているか、リダイレクトが承認された先にしか行かないかを確認します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Handle cross-origin requests securely
The Same-Origin Policy is the browser's primary defense against malicious sites stealing data or performing actions on behalf of your users. Misconfiguring CORS or failing to validate postMessage origins can allow attackers to bypass this protection — reading private data, submitting forms as users, or injecting content into your pages.
Quick Reference
- Always verify event.origin before processing postMessage data
- Never set Access-Control-Allow-Origin: * for authenticated endpoints
- Validate and sanitize all data received from cross-origin messages
- Use SameSite cookies to prevent CSRF from cross-origin requests
- Reject unvalidated redirect targets such as
next,redirect, orcallbackUrl
Check
Check this code for insecure cross-origin patterns: missing origin validation in postMessage listeners, overly permissive CORS settings, and missing CSRF protections. Flag redirect parameters that accept arbitrary external URLs.
Fix
Add origin validation to postMessage listeners and review CORS configuration to ensure it's not overly permissive for authenticated routes. Reject or allow-list untrusted redirect destinations before navigating.
Explain
Explain the Same-Origin Policy, how CORS works, and how to securely use postMessage for cross-origin communication.
Code Review
Review scripts, client components, and browser execution paths related to Handle cross-origin requests securely. Flag exact imports, event handlers, runtime side effects, or blocking operations that violate the rule, and state how the change should be verified in the browser. Check login, logout, SSO, and return-to flows for open redirects.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/javascript/cross-origin-security
よくある質問
同一オリジンポリシーとは何ですか?
悪意のあるサイトが利用者のデータを読んだり、それに作用したりすることに対する、ブラウザの主要な防御だと、このスキルは説明しています。
メッセージについて、エージェントは何を確認しますか?
データを使う前に、メッセージの送信元のオリジンが確認されていることです。
リダイレクトのパラメーターは、なぜ危険ですか?
確認または承認されていない限り、利用者を任意の外部サイトに送るおそれがあると、このスキルは説明しています。
詳細
作者による元の説明
Use when reviewing scripts, client components, bundles, or runtime behavior related to Handle cross-origin requests securely. Inspect both source code and the browser execution path so fixes target the real bottleneck or bug.
人気
- GitHubのスター
- 75k
- ランキング
- #2793
- ライセンス
- MIT
- 更新日
- 2026/10/31
コメント
- …
このリポジトリの他のスキル
frontendchecklist
75kコマンドラインツールを使って、フロントエンドのコードとライブページを、アクセシビリティ、速度、SEO、セキュリティに関する380以上のルールと照らし合わせて確認します。
frontend-checklist-global
75kフロントエンドのプロジェクトを、386のFront-End Checklistのルールすべてと照らし合わせて監査し、見つかった問題ごとに具体的な修正方法を示します。
404-page
75k見つからないページの画面に役立つリンクがあり、本物の404ステータスを返すかを確認し、迷った訪問者が目的のページを見つけられるようにします。
about-page
75kサイトの運営者が誰かを説明する、分かりやすいAboutページがあるかを確認し、訪問者と検索エンジンからの信頼を高めます。
似ているスキル
reverse-engineer-anything
422kREAツールを使って、出荷済みのアプリやパッケージの中身を調べ、機能の説明、版の比較、再構築の手順をエージェントが支援します。
1password
394k1Password CLIをセットアップし、サインインして、秘密情報の値を会話に表示せずに読み取ったり注入したりするようエージェントを支援します。
healthcheck
394kOpenClawを動かすコンピューターやサーバーを、SSH、ファイアウォール、更新、バックアップなどのセキュリティリスクについて監査し、安全な修正案を提案するようエージェントを支援します。