security-gate
Verify security considerations were addressed before shipping. Issues result in WARNINGS that strongly recommend fixing.
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o security-gate.zip https://jpskill.com/download/18290.zip && unzip -o security-gate.zip && rm security-gate.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/18290.zip -OutFile "$d\security-gate.zip"; Expand-Archive "$d\security-gate.zip" -DestinationPath $d -Force; ri "$d\security-gate.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
security-gate.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
security-gateフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
Gate 2: セキュリティレビュー
「セキュリティは後から追加する機能ではありません。それは構築する基盤です。」
目的
このゲートは、一般的なセキュリティ脆弱性が本番環境に到達する前に捕捉します。問題はブロックしませんが、強い警告を生成します。
ゲートステータス
- PASS — セキュリティ上の問題は見つかりませんでした
- WARNING — 本番環境に移行する前に修正すべき問題が見つかりました
- CRITICAL WARNING — 実際にブロックすべき重大な問題
ゲートの質問
質問 1: 入力エントリポイント
「ユーザー入力は、この機能のどこから入ってきますか?」
確認事項:
- すべての入力元(フォーム、URL、ヘッダーなど)の認識
- すべての入力が信頼できないという理解
- データフローの特定
入力が存在する場合のフォローアップ:
「その入力は、使用される前にどのように検証されますか?」
質問 2: データアクセス
「この機能はどのようなデータにアクセスしますか?誰がそれにアクセスできるべきですか?」
確認事項:
- データの機密性の理解
- 認証要件の認識
- 誰が何を見ることができるかの知識
フォローアップ:
「リクエストしているユーザーがこのデータにアクセスすることを許可されていることをどのように確認しますか?」
質問 3: シークレットと露出
「シークレット、トークン、または機密データはありますか?それらはどこに保存されていますか?」
確認事項:
- コードではなく環境変数にシークレットがあること
- ログに機密データがないこと
- URLまたはクライアント側のストレージにトークンがないこと(必要な場合を除く)
セキュリティチェックリスト
以下の一般的な問題についてコードを確認してください。
入力処理
- [ ] すべてのユーザー入力がサーバー側で検証されている
- [ ] 入力長の制限が適用されている
- [ ] 特殊文字が処理されている(SQL、HTML、シェル)
- [ ] ファイルアップロードが検証されている(タイプ、サイズ、コンテンツ)
認証と認可
- [ ] 保護されたルートには認証が必要
- [ ] ユーザーは自分のデータにのみアクセスできる
- [ ] 管理者ルートは管理者ロールをチェックする
- [ ] トークンには妥当な有効期限がある
データ露出
- [ ] APIレスポンスに不要なフィールドが含まれていない
- [ ] エラーが内部の詳細を公開しない
- [ ] ログにパスワード/トークンが含まれていない
- [ ] URLに機密データがない
一般的な脆弱性
- [ ] SQL文字列の連結がない
- [ ] ユーザー入力で
eval()またはnew Function()が使用されていない - [ ] サニタイズされていないユーザー入力で
innerHTMLが使用されていない - [ ] コードにハードコードされたシークレットがない
レスポンステンプレート
PASS の場合
✅ SECURITY GATE: PASSED
セキュリティに関する考慮事項に対処済み:
- 入力検証: ✓
- 認証チェック: ✓
- 露出したシークレットなし: ✓
次のゲートに進みます...
WARNING の場合
⚠️ SECURITY GATE: WARNING
対処すべきセキュリティに関する考慮事項を [X] 個見つけました:
**Issue 1: [タイトル]**
場所: `file.ts:42`
リスク: [何が問題になる可能性があるか]
質問: 「悪意のあるユーザーが [攻撃シナリオ] を阻止するものは何ですか?」
**Issue 2: [タイトル]**
場所: `file.ts:88`
リスク: [何が問題になる可能性があるか]
提案: [修正の方向性、答えではない]
これらは本番環境に移行する前に修正する必要があります。
今すぐ対処しますか?
CRITICAL WARNING の場合
🚨 SECURITY GATE: CRITICAL WARNING
先に進む前に注意が必要です:
**CRITICAL: [問題]**
場所: `file.ts:42`
リスク: [重大度の説明 - データ侵害、アカウントの乗っ取りなど]
これはニュースの見出しになるような脆弱性です。
何よりも先にこれを修正しましょう。
確認すべき一般的な脆弱性
SQLインジェクション
❌ db.query(`SELECT * FROM users WHERE id = ${userId}`);
✅ db.query('SELECT * FROM users WHERE id = ?', [userId]);
クロスサイトスクリプティング (XSS)
❌ element.innerHTML = userInput;
✅ element.textContent = userInput;
不正な直接オブジェクト参照 (IDOR)
❌ // 誰でも任意のユーザーのデータにアクセスできる
app.get('/users/:id', (req, res) => {
const user = await User.findById(req.params.id);
res.json(user);
});
✅ // 所有権の確認
app.get('/users/:id', (req, res) => {
const user = await User.findById(req.params.id);
if (user.id !== req.user.id) throw new ForbiddenError();
res.json(user);
});
ハードコードされたシークレット
❌ const apiKey = 'sk-live-abc123';
✅ const apiKey = process.env.API_KEY;
ソクラテス式セキュリティ質問
修正点を指摘する代わりに、以下を尋ねてください。
- 「ユーザーAがIDを変更してユーザーBのデータにアクセスするのを阻止するものは何ですか?」
- 「私の名前として
<script>alert('XSS')</script>を送信するとどうなりますか?」 - 「誰かがこのエンドポイントに10MBのデータを送信したらどうなりますか?」
- 「このリポジトリをクローンした場合、どのようなシークレットが表示されますか?」
- 「誰かが別のユーザーのトークンを推測した場合、どうなりますか?」
リスクレベルガイド
| 問題 | リスクレベル | アクション |
|---|---|---|
| SQLインジェクションの可能性 | CRITICAL | 修正必須 |
| 認証にレート制限がない | HIGH | 修正推奨 |
| 認証チェックがない | HIGH | 修正推奨 |
| XSSの可能性 | HIGH | 修正推奨 |
| 詳細なエラーメッセージ | MEDIUM | 修正を推奨 |
| 入力検証がない | MEDIUM | 修正を推奨 |
| CSRF保護がない | MEDIUM | 修正を推奨 |
| CORSが寛容すぎる | LOW | レビューのためにメモ |
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Gate 2: Security Review
"Security isn't a feature you add later. It's a foundation you build on."
Purpose
This gate catches common security vulnerabilities before they reach production. Issues don't BLOCK, but generate strong WARNINGS.
Gate Status
- PASS — No security issues found
- WARNING — Issues found that should be fixed before production
- CRITICAL WARNING — Severe issues that really should block
Gate Questions
Question 1: Input Entry Points
"Where does user input enter this feature?"
Looking for:
- Awareness of all input sources (forms, URLs, headers, etc.)
- Understanding that ALL input is untrusted
- Identification of data flow
Follow-up if input exists:
"How is that input validated before it's used?"
Question 2: Data Access
"What data does this feature access? Who should be able to access it?"
Looking for:
- Understanding of data sensitivity
- Awareness of authorization requirements
- Knowledge of who can see what
Follow-up:
"How do you verify the requesting user is allowed to access this data?"
Question 3: Secrets and Exposure
"Are there any secrets, tokens, or sensitive data involved? Where are they stored?"
Looking for:
- Secrets in environment variables, not code
- No sensitive data in logs
- No tokens in URLs or client-side storage (unless necessary)
Security Checklist
Review the code for these common issues:
Input Handling
- [ ] All user input validated server-side
- [ ] Input length limits enforced
- [ ] Special characters handled (SQL, HTML, shell)
- [ ] File uploads validated (type, size, content)
Authentication & Authorization
- [ ] Protected routes require authentication
- [ ] Users can only access their own data
- [ ] Admin routes check admin role
- [ ] Tokens have reasonable expiration
Data Exposure
- [ ] API responses don't include unnecessary fields
- [ ] Errors don't expose internal details
- [ ] Logs don't contain passwords/tokens
- [ ] No sensitive data in URLs
Common Vulnerabilities
- [ ] No SQL string concatenation
- [ ] No
eval()ornew Function()with user input - [ ] No
innerHTMLwith unsanitized user input - [ ] No hardcoded secrets in code
Response Templates
If PASS
✅ SECURITY GATE: PASSED
Security considerations addressed:
- Input validation: ✓
- Authorization checks: ✓
- No exposed secrets: ✓
Moving to the next gate...
If WARNING
⚠️ SECURITY GATE: WARNING
I found [X] security considerations to address:
**Issue 1: [Title]**
Location: `file.ts:42`
Risk: [What could go wrong]
Question: "What stops a malicious user from [attack scenario]?"
**Issue 2: [Title]**
Location: `file.ts:88`
Risk: [What could go wrong]
Suggestion: [Direction to fix, not the answer]
These should be fixed before this goes to production.
Would you like to address them now?
If CRITICAL WARNING
🚨 SECURITY GATE: CRITICAL WARNING
This needs attention before proceeding:
**CRITICAL: [Issue]**
Location: `file.ts:42`
Risk: [Severity explanation - data breach, account takeover, etc.]
This is the kind of vulnerability that makes news headlines.
Let's fix this before anything else.
Common Vulnerabilities to Check
SQL Injection
❌ db.query(`SELECT * FROM users WHERE id = ${userId}`);
✅ db.query('SELECT * FROM users WHERE id = ?', [userId]);
Cross-Site Scripting (XSS)
❌ element.innerHTML = userInput;
✅ element.textContent = userInput;
Insecure Direct Object Reference (IDOR)
❌ // Anyone can access any user's data
app.get('/users/:id', (req, res) => {
const user = await User.findById(req.params.id);
res.json(user);
});
✅ // Check ownership
app.get('/users/:id', (req, res) => {
const user = await User.findById(req.params.id);
if (user.id !== req.user.id) throw new ForbiddenError();
res.json(user);
});
Hardcoded Secrets
❌ const apiKey = 'sk-live-abc123';
✅ const apiKey = process.env.API_KEY;
Socratic Security Questions
Instead of pointing out the fix, ask:
- "What stops user A from accessing user B's data by changing the ID?"
- "If I send
<script>alert('XSS')</script>as my name, what happens?" - "What if someone sends 10MB of data to this endpoint?"
- "If I cloned this repo, what secrets would I see?"
- "What happens if someone guesses another user's token?"
Risk Level Guide
| Issue | Risk Level | Action |
|---|---|---|
| SQL injection possible | CRITICAL | Must fix |
| No rate limiting on auth | HIGH | Should fix |
| Missing authorization check | HIGH | Should fix |
| XSS possible | HIGH | Should fix |
| Verbose error messages | MEDIUM | Recommend fix |
| Missing input validation | MEDIUM | Recommend fix |
| No CSRF protection | MEDIUM | Recommend fix |
| CORS too permissive | LOW | Note for review |