コードレビュー向けの思考連鎖(Chain-of-Thought)プロンプト
LLMを、実行可能な修正案を提示する構造化されたセキュリティレビュアーに変える、再利用可能で厳密なプロンプトを求める開発者向けです。
入力と出力のプレビューを見る
入力
- タスクの説明
- Create a prompt that makes the model review a Python function for security vulnerabilities (SQL injection, unsafe deserialization, secrets in code), explain each finding with severity, and suggest a fix with corrected code.
- 対象AIモデル
- Claude (Anthropic)
- プロンプトのスタイル
- 思考の連鎖(ステップバイステップの推論)
- 希望する出力形式
- コード / 技術
- 複雑さのレベル
- 上級 (詳細でニュアンスのある)
出力(抜粋)
You are a senior application-security engineer. Review the Python function below. Think step by step: (1) trace untrusted inputs, (2) check for SQL injection, unsafe deserialization, and hardcoded secrets, (3) rank each finding by severity (Critical/High/Medium/Low). For every issue, output: location, why it's exploitable, and a corrected code block. If no issues exist in a category, state so explicitly. Format your final answer as Markdown with a findings table followed by the fixed function.