Cloudflare Security Audit

A security auditing skill for coding agents, featuring an adversarial verification pipeline and isolated sandboxing when developing software with AI.

Cloudflare Security Audit

Cloudflare Security Audit: Codebase security auditing for coding agents

When developers use tools like Cursor or Claude Code, code generation speed increases dramatically. Reviewing all that generated code for vulnerabilities becomes the real bottleneck. Asking an AI model to review code using plain prompts often causes two familiar problems: noisy false positives, or the model defending theoretical bugs that cannot actually be exploited.

Security Audit Skill comes from Cloudflare's AI Security Research team (Dan Jones, Alexandra Godoi, Grant Bourzikas). It started as a compact, ~450-line skill running on individual repositories. Cloudflare later expanded it into an internal automated auditing pipeline run across more than 140 production services, identifying over 13,000 security issues.

This kit equips your coding agent to review and detect security flaws across an entire codebase before you merge or deploy changes.


1. Attack classes covered

Rather than running superficial checks, the skill groups its audits into concrete modules defined in ATTACK-CLASSES.md:

Audit Domain Core Vulnerability Classes Specification File
Web & API Protocols HTTP request framing, header smuggling, session and JWT auth, SSRF, IDOR, authorization logic. WEB-PROTOCOL-AND-AUTH.md
Memory Safety & Systems Memory management in C, C++, Rust, and Go; buffer overflows; use-after-free; kernel boundaries. MEMORY-SAFETY-AND-BINARY.md
Client-Side Security DOM XSS, prototype pollution, postMessage origin validation, secret leaks in client bundles. CLIENT-SIDE.md
Infrastructure & CI/CD CI/CD pipeline vulnerabilities, dependency injection, IAM permissions, secret drift in IaC templates. SUPPLY-CHAIN-AND-RELEASE.md
AI & MCP Application Layer Indirect prompt injection via tools or RAG, loose schema parsers, tenant bleed, MCP server confusion. AI-AND-LLM.md

2. Adversarial audit workflow

The defining rule in Cloudflare's workflow is simple: the agent that finds a vulnerability candidate never validates it.

[!NOTE] Cloudflare's original research blog described a 7-phase flow because it included uploading findings to an internal dashboard. This open-source version streamlines that down to 6 local phases with no external dependencies.

Cloudflare 6-Phase Adversarial Security Audit Pipeline
Cloudflare 6-Phase Adversarial Security Audit Pipeline

The process runs in four steps:

  • Reconnaissance and ledger: Scans the repository structure, maps trust boundaries, and records test targets in a deterministic coverage-ledger.json file.
  • Independent hunting (Hunter): Each Hunter agent receives a narrow scope from the ledger, checks the code, and writes suspected issues to scratch/.
  • Independent verification (Verifier): A fresh Verifier agent evaluates each candidate, attempting to disprove it with actual code checks to eliminate false alarms.
  • Categorization and reporting: Findings are sorted into confirmed (verified with a reproducer), needs_validation (requires live staging tests), or rejected (disproved).

3. Sandboxing and execution safety

Letting an autonomous agent compile code or run exploit tests without boundaries can damage local development machines or leak secrets. The skill enforces three controls:

  • No external network access: The test harness blocks outbound internet access completely, allowing only local loopback calls for client-server integration checks.
  • Read-only code and scratch directories: The target repository is mounted read-only. Sub-agents only write temporary data to scratch/<agent-id>/. The canonical artifacts/ folder belongs exclusively to the parent runner.
  • File promotion checks: To move proof files from scratch/ to artifacts/, the runner inspects them through file descriptors (fstat), rejects symlinks, checks byte limits, and blocks FIFOs or sockets.

4. Installation and usage

You can use this skill with Cursor, Claude Code, Windsurf, or any environment supporting the SKILL.md format.

Method 1: Install with Skills CLI

Install using the repository URL and the --skill flag:

# Add to the current workspace
npx skills add https://github.com/cloudflare/security-audit-skill --skill security-audit

# Or install globally for all projects
npx skills add https://github.com/cloudflare/security-audit-skill --skill security-audit --global

Method 2: Clone manually

git clone https://github.com/cloudflare/security-audit-skill.git .agents/skills/security-audit

[!IMPORTANT] By default, the skill writes reports outside the project to ~/security-audit-skill/<repo-name>/run-<N>. If you write inside the repository instead, add that directory to .gitignore so the agent does not scan its own report files.

Running an audit

In your coding agent chat prompt, run:

Run a comprehensive security audit on this repository using the security-audit-skill workflow.
Focus on:
1. Input surfaces, trust boundaries, and deterministic ledger creation (Phase 1 Recon).
2. Relevant attack classes based on our tech stack (web APIs, memory safety, auth, dependencies).
3. Validate all candidate findings adversarially before generating final reports.

Generated reports

When the run finishes, the tool leaves three files:

  • REPORT.md: Summary of tested areas and code coverage metrics.
  • FINDINGS-DETAIL.md: Confirmed vulnerabilities with source code references and fix suggestions.
  • NEEDS-VALIDATION.md: Suspected issues that need checking on staging or production.
|Share:

Links