intermediateFree course

AI Agents for Whitehat Security

Code audits, authorized pentesting and security gates with Claude Code and Codex, practiced on OWASP Juice Shop

  • 8 modules
  • 30 lessons

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 lessons
01Ground 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.

  1. 1.1Authorization, scope and rules of engagement
  2. 1.2Your lab: Juice Shop and a safe agent workspace
  3. 1.3What 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.

  1. 2.1Inside the agent loop
  2. 2.2Claude Code set up for security work
  3. 2.3Codex, Cursor and open-weight harnesses side by side
  4. 2.4Local models: when, which, and what it costs you
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.

  1. 3.1Threat model of a coding agent
  2. 3.2Permissions, sandboxing and containers
  3. 3.3Your first hook: a scope guard
  4. 3.4MCP servers, plugins and the supply chain
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.

  1. 4.1Recon: mapping a codebase with an agent
  2. 4.2Source-to-sink tracing
  3. 4.3Agent plus scanners: Semgrep and CodeQL
  4. 4.4Proving findings and killing false positives
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.

  1. 5.1From copy-paste prompts to skills
  2. 5.2Subagents for audit roles
  3. 5.3Packaging and installing the whitehat plugin
  4. 5.4Headless and reproducible runs
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.

  1. 6.1Designing layered security gates
  2. 6.2The edit gate: checking code as the agent writes it
  3. 6.3Stop hooks, pre-commit and secrets
  4. 6.4Security review in CI
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.

  1. 7.1Scope in code, not in the prompt
  2. 7.2Mapping the attack surface
  3. 7.3Testing with evidence
  4. 7.4Humans in the loop and stop conditions
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.

  1. 8.1Build a benchmark you can trust
  2. 8.2Comparing models and harnesses fairly
  3. 8.3The report and your capstone

// 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.