Enforces secure coding practices. Required after all code implementations to run CodeGuard security check. Covers input validation, secrets management, and OWASP countermeasures.
Enforces secure coding practices by requiring CodeGuard security checks after all code implementations. Triggers automatically after code completion to validate input handling, secrets management, and OWASP countermeasures.
/plugin marketplace add sumik5/sumik-claude-plugin/plugin install sumik@sumikThis skill inherits all available tools. When active, it can use any tool Claude has access to.
AUTH-SECRETS.mdINPUT-VALIDATION.mdOWASP-TOP10.mdSECURE-HEADERS.md必須タイミング:
推奨タイミング:
1. コード実装完了
↓
2. CodeGuard実行(必須)
Skill tool: /codeguard-security:software-security
↓
3. 脆弱性検出
↓
4. 指摘された問題を修正
↓
5. 再度CodeGuardで検証
↓
6. すべてクリアを確認
↓
7. 完了報告
# Skill toolを使用
/codeguard-security:software-security
重要:
// ✅ 入力検証
import { z } from 'zod'
const schema = z.object({
email: z.string().email(),
age: z.number().min(0).max(150)
})
const validated = schema.parse(input)
// ✅ プリペアドステートメント
const user = await db.query(
'SELECT * FROM users WHERE id = $1',
[userId] // パラメータバインディング
)
// ✅ エスケープ処理
import DOMPurify from 'dompurify'
const sanitized = DOMPurify.sanitize(userContent)
// ✅ 環境変数
const apiKey = process.env.API_KEY
// ❌ ハードコーディング禁止
const apiKey = "key123" // 絶対禁止
// ✅ パスワードハッシュ化
import bcrypt from 'bcrypt'
const hashed = await bcrypt.hash(password, 10)
// ✅ 認可チェック
if (currentUser.role !== 'admin') {
throw new Error('Unauthorized')
}
コード実装完了時に必ず確認:
OWASP Top 10の各脆弱性についての詳細解説と対策方法:
入力検証、サニタイゼーション、各種インジェクション攻撃への対策:
認証、認可、機密情報の安全な管理方法:
HTTPヘッダー、ファイルアップロード、その他のセキュリティ対策:
設計段階からセキュリティを考慮
実装時の心構え
継続的なセキュリティ向上
eval()やexec()を使用する(特別な理由がない限り)次のステップ: 各詳細ガイドを参照して、セキュアなコードを実装してください。