Güvenlik ve İzinler İleri
Yapay Zeka Destekli Komut Doğrulama
İkinci bir AI modelinin komutları çalıştırmadan önce doğrulamasını sağlamak için prompt tipi hook kullanın
Komut
"color:#9CA3AF;font-style:italic"># ."color:#7C5CFC">claude/settings.json $ { "hooks": { "PreToolUse": [{ "matcher": "Bash", "hooks": [{ "type": "prompt", "prompt": "Is this bash command safe? $ARGUMENTS\n\nDeny ">if it contains: rm -rf, DROP TABLE, or modifies system files.", "model": "">claude-3-5-haiku-20241022", "timeout": 30 }] }] } }
Yanıt
// The prompt hook evaluates the command using a fast model // Returns exit 0 (allow) or exit 2 (block) based on AI judgment
Ayrıştırma Kodu
059669">">// Prompt hooks use $ARGUMENTS placeholder 059669">">for the tool input 059669">">// The model evaluates and decides: allow or block 059669">">// Works with any model — use Haiku 059669">">for speed, Opus for thoroughness
Tuzaklar
! Gecikme ekler (her Bash komutundan önce AI değerlendirmesi) ancak incelikli riskleri yakalar
! Gecikmeyi en aza indirmek için hızlı bir model (Haiku) kullanın — prompt hook'ları senkron çalışır