Security scanning templates and checklists for OWASP Top 10, authentication, authorization, data protection. Use when conducting security testing or vulnerability assessment. This skill provides comprehensive security testing: - OWASP Top 10 checklist with remediation - Authentication and authorization testing - Data protection verification - Security report generation - Integration with Codex CLI MCP for automated scanning Triggers: "security scan", "vulnerability check", "OWASP", "security test", "セキュリティスキャン", "脆弱性チェック", "セキュリティテスト"
Conducts comprehensive security scans using OWASP Top 10 checklists for authentication, authorization, and data protection. Triggers on requests like "security scan" or "vulnerability check" to identify critical vulnerabilities and generate structured reports.
/plugin marketplace add takemi-ohama/ai-agent-marketplace/plugin install ndf@ai-agent-marketplaceThis skill inherits all available tools. When active, it can use any tool Claude has access to.
このSkillは、qaエージェントがセキュリティスキャンと脆弱性評価を実施する際に使用します。OWASP Top 10に基づいた包括的なチェックリストと、認証・認可・データ保護の検証手順を提供します。
checklists/
├── owasp-top10-checklist.md # OWASP Top 10
├── auth-checklist.md # 認証・認可
└── data-protection-checklist.md # データ保護
templates/
└── security-report-template.md # セキュリティレポート
脆弱性の説明: 信頼できないデータがコマンドやクエリの一部として送信され、攻撃者が意図しないコマンドを実行したり、適切な認可なしにデータにアクセスしたりできる。
チェック項目:
SQLインジェクション対策
// ❌ Bad: 文字列連結
const query = `SELECT * FROM users WHERE id = ${userId}`;
// ✅ Good: パラメータ化クエリ
const query = 'SELECT * FROM users WHERE id = ?';
db.query(query, [userId]);
コマンドインジェクション対策
// ❌ Bad: ユーザー入力を直接使用
exec(`ping ${userInput}`);
// ✅ Good: ホワイトリスト検証 + エスケープ
if (!/^[a-zA-Z0-9.-]+$/.test(userInput)) {
throw new Error('Invalid input');
}
LDAPインジェクション対策
NoSQLインジェクション対策
// ❌ Bad: オブジェクトを直接使用
User.find({ username: req.body.username });
// ✅ Good: 型検証
const username = String(req.body.username);
User.find({ username });
修正方法:
チェック項目:
パスワードの安全なハッシュ化
// ❌ Bad: 平文保存、MD5/SHA1
const hash = md5(password);
// ✅ Good: bcrypt/Argon2
const bcrypt = require('bcrypt');
const hash = await bcrypt.hash(password, 10);
セッション管理
多要素認証(MFA)
ブルートフォース攻撃対策
パスワードポリシー
修正方法:
チェック項目:
通信の暗号化
保存時の暗号化
// ✅ Good: AES-256で暗号化
const crypto = require('crypto');
const algorithm = 'aes-256-cbc';
const key = crypto.randomBytes(32);
const iv = crypto.randomBytes(16);
function encrypt(text) {
const cipher = crypto.createCipheriv(algorithm, key, iv);
let encrypted = cipher.update(text, 'utf8', 'hex');
encrypted += cipher.final('hex');
return encrypted;
}
機密情報のログ出力禁止
// ❌ Bad
console.log('User password:', password);
logger.info('Credit card:', creditCard);
// ✅ Good
logger.info('User authenticated', { userId: user.id });
APIキー・シークレットの管理
修正方法:
チェック項目:
XML パーサーの安全な設定
// ✅ Good: DTD処理を無効化
const { XMLParser } = require('fast-xml-parser');
const parser = new XMLParser({
ignoreAttributes: false,
processEntities: false // DTD処理を無効化
});
外部エンティティの禁止
DTD処理の無効化
修正方法:
チェック項目:
認可チェックの実装
// ✅ Good: ミドルウェアで認可チェック
function requireAdmin(req, res, next) {
if (req.user.role !== 'admin') {
return res.status(403).json({ error: 'Forbidden' });
}
next();
}
app.delete('/api/users/:id', authMiddleware, requireAdmin, deleteUser);
ロールベースアクセス制御(RBAC)
オブジェクトレベルの認可
// ❌ Bad: IDだけで削除
app.delete('/api/posts/:id', async (req, res) => {
await Post.destroy({ where: { id: req.params.id } });
});
// ✅ Good: 所有者チェック
app.delete('/api/posts/:id', authMiddleware, async (req, res) => {
const post = await Post.findByPk(req.params.id);
if (post.userId !== req.user.id) {
return res.status(403).json({ error: 'Forbidden' });
}
await post.destroy();
});
IDORの防止(Insecure Direct Object Reference)
修正方法:
チェック項目:
デフォルトパスワードの変更
不要なサービスの無効化
セキュリティヘッダーの設定
// ✅ Good: helmet.js でセキュリティヘッダー設定
const helmet = require('helmet');
app.use(helmet());
app.use(helmet.contentSecurityPolicy({
directives: {
defaultSrc: ["'self'"],
scriptSrc: ["'self'", "'unsafe-inline'"],
styleSrc: ["'self'", "'unsafe-inline'"]
}
}));
エラーメッセージの適切化
// ❌ Bad: 詳細なエラーを公開
res.status(500).json({ error: error.stack });
// ✅ Good: 一般的なエラーメッセージ
res.status(500).json({ error: 'Internal server error' });
// 詳細はログに記録
logger.error('Error details:', error);
CORSの適切な設定
// ✅ Good: 特定のオリジンのみ許可
const cors = require('cors');
app.use(cors({
origin: 'https://example.com',
credentials: true
}));
修正方法:
チェック項目:
HTMLエスケープ
// ❌ Bad: 直接HTMLに挿入
document.getElementById('output').innerHTML = userInput;
// ✅ Good: エスケープして挿入
document.getElementById('output').textContent = userInput;
// または DOMPurify を使用
import DOMPurify from 'dompurify';
const clean = DOMPurify.sanitize(userInput);
Content-Security-Policy (CSP) 設定
HTTPOnlyクッキー
// ✅ Good: HTTPOnly, Secure, SameSite
res.cookie('token', token, {
httpOnly: true,
secure: true,
sameSite: 'strict'
});
DOMベースXSS対策
eval(), innerHTML, document.write() を避ける修正方法:
8. 安全でないデシリアライゼーション
9. 既知の脆弱性があるコンポーネント
npm audit / pip-audit の実行10. ログとモニタリングの不足
ログイン機能
セッション管理
トークン管理(JWT)
ロールベースアクセス制御
リソース所有者チェック
# セキュリティスキャンレポート - [アプリケーション名]
## エグゼクティブサマリー
- スキャン日: 2023-12-15
- スキャン範囲: Web アプリケーション全体
- 重大な脆弱性: 2件
- 警告: 5件
- 情報: 3件
## 重大な脆弱性 🔴
### 1. SQLインジェクション
- **場所**: `/api/users` エンドポイント
- **リスクレベル**: 高
- **説明**: ユーザー入力が直接SQLクエリに連結されている
- **影響**: データベース全体へのアクセス、データ改ざん
- **修正方法**: パラメータ化クエリを使用
```javascript
// 修正前
const query = `SELECT * FROM users WHERE id = ${userId}`;
// 修正後
const query = 'SELECT * FROM users WHERE id = ?';
db.query(query, [userId]);
/admin パネル
## Codex CLI MCP統合
```javascript
// Codex でセキュリティスキャン実行
const result = await codex({
prompt: `
以下のコードをセキュリティスキャンしてください:
- OWASP Top 10 の脆弱性
- 認証・認可の問題
- 機密情報の露出
${codeContent}
`,
'approval-policy': 'on-request'
});
✅ 定期的なスキャン: 月1回以上 ✅ 自動化: CI/CDパイプラインに統合 ✅ 重大度の優先順位: 高→中→低の順で対応 ✅ 修正の検証: 修正後に再スキャン ✅ 開発者教育: セキュアコーディング研修
❌ スキャンのみで満足: 修正まで実施 ❌ 警告を無視: すべての指摘を確認 ❌ 本番環境で初スキャン: 開発段階から実施 ❌ 自動化ツールに全依存: 手動レビューも重要
このSKILL.mdはメインドキュメント(約400行)です。詳細なチェックリストは checklists/ ディレクトリ内のファイルを参照してください。
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.