AI Agents for Whitehat Security
Code audits, authorized pentesting and security gates with Claude Code and Codex, practiced on OWASP Juice Shop
What you'll learn
- Run AI-assisted code audits that produce evidence-backed findings instead of guesses
- Pentest an authorized target with an agent whose scope is enforced by hooks and sandboxing, not just by the prompt
- Protect yourself and your machine from prompt injection and hostile repositories when an agent reads untrusted code
- Install and extend Claude Code hooks, skills, subagents and plugins for security work
- Add layered security gates to a development workflow, from edit-time checks to CI
- Measure precision and recall of your own AI security setup and compare models and harnesses fairly
- Write a professional report from AI-assisted work that a maintainer or client can trust
About this course
AI coding agents can read a codebase faster than any human, follow data across files, and run tools for hours. They can also invent vulnerabilities, miss obvious ones, follow instructions hidden in the code they read, and act outside your scope. This course shows you how to get the first without the second.
You will run OWASP Juice Shop on your own machine from the first module and use it all the way through: as a codebase to audit, as a running target to pentest within a scope that your agent enforces, and as a test bench to measure how good your setup really is. Claude Code is the main tool, and Codex CLI is the main comparison for a second review pass. Cursor is covered in the dedicated harness comparison. Open-weight setups through Codex CLI, OpenCode and Ollama are also compared on the same tasks.
Along the way you build up, piece by piece, an open-source Claude Code plugin (whitehat-harness): a scope guard hook, an edit-time security gate that makes the agent check what it just wrote, and audit and pentest skills that turn chat into findings files with evidence. You start with copy-paste prompts so you understand each step, then install the plugin and automate them.
Everything here is checked against current documentation and tested on real tools. Where a tool has a known weakness or a claim cannot be verified, the lesson says so.
Curriculum
8 modules · 30 lessons01Ground rules and your lab3 lessons
What you may test, how to set up OWASP Juice Shop and a safe workspace for an agent, and a realistic picture of what AI agents find and what they invent.
02How agent harnesses work4 lessons
The loop behind every coding agent, Claude Code configured for security work, Cursor and open-weight harnesses side by side, and when a local model is the right choice.
03Securing the agent itself4 lessons
Your agent reads hostile input for a living. Threat model it, lock it down with permissions and sandboxing, write your first scope guard hook, and vet MCP servers and plugins.
04AI-assisted code audit4 lessons
Audit the Juice Shop source with an agent: recon and threat model, source-to-sink tracing, pairing the agent with Semgrep and CodeQL, and proving or killing every finding.
05From prompts to a plugin4 lessons
Turn the copy-paste workflow into skills, subagents and hooks, package them as a Claude Code plugin, install whitehat-harness, and run it headless and reproducibly.
06Security gates for developers4 lessons
Make the agent check the code it writes: layered gate design, an edit-time hook, Stop and pre-commit gates, and CI review that fails closed without drowning the team in noise.
07Authorized pentest of a running app4 lessons
Test the running Juice Shop with an agent: scope enforced in code, attack-surface mapping, evidence-backed exploitation checks, and human control over every risky step.
08Measure, compare and report3 lessons
Build a benchmark from Juice Shop, measure precision and recall of your setup, compare models and harnesses fairly, and write a report people can trust.
// final project
Final project
Run a complete authorized engagement against your local OWASP Juice Shop. Set the scope with /whitehat:scope, map the code and the running app, and produce at least five confirmed findings, each with a reproducing test or in-scope request, a fix and a regression test. Then add the security gate to a project of your own and show one case where it caught an issue during agent coding. Finally, measure your setup's precision and recall on a benchmark you build from Juice Shop's challenge list, and submit the report generated with /whitehat:report plus a one-page reflection on what the agent got wrong.
Prerequisites
- Comfortable on the command line (bash or zsh)
- Can read JavaScript or TypeScript
- Docker and Node.js 22+ installed
- Access to at least one coding agent (Claude Code recommended; Codex is the main alternative; local models are optional)
Who it's for
Developers who want their AI agent to write safer code, security engineers and pentesters who want to use agents without losing rigor, and newcomers to either. Each lesson starts with the basics and ends with material that experienced practitioners will find new: measurement, agent security, and failure modes.
