Repository navigation
Episode 16 – AI Red Teaming in .NET: Hack Your Own AI Agent, Then Fix It
·
7 commits
to series/dotnet-ai
since this release
🚀 Episode 16 – AI Red Teaming: Attack Your Own .NET AI Agent, Then Harden It
Complete .NET AI Developer Series – In this episode we attack the EP15 AI agent with five real attacks, then fix every hole with six guards and prove it with a final red-team run.
🎯 What's Included
- Dev-only red-team endpoint: POST api/AgentV1/redteam
- AttackCase record with MustNotContain and MustContainAny scoring
- Five attacks: system prompt leak, fake admin, forged assistant turn, poisoned PDF and tool spam
- Fix 1: AgentGuard request validation (messages, characters and roles)
- Fix 2: Hardened system prompt with SECURITY RULES
- Fix 3: ToolResultGuard to wrap and clean tool output
- Fix 4: Tool call budget (MaxToolCalls = 8)
- Fix 5: Safe errors with ILogger and input limits on search_documents and calculate
- Fix 6: Rate limiting with AddRateLimiter (10 requests per minute per IP, 429 response)
- Final red-team runs and live attack demos in the React agent tab
📺 Watch the Video
[Add EP16 YouTube URL]
📚 Playlist
https://www.youtube.com/playlist?list=PLF4drO8z96Rc
💻 Repository
https://github.com/sandeeppatil-newvision/Complete-DotNet-AI-API
⭐ If this episode helped you, please star the repository and subscribe to the channel.