Cloudflare's security-audit-skill: A Six-Phase Agent Harness for Auditing a Codebase, With the JSON-Schema-Verified Receipts to Match — aniketkarneai.com | aniketkarneai.com
Wednesday, November 11, 2026 Field notes on autonomous systems ● Amsterdam, NL
daily

Cloudflare's security-audit-skill: A Six-Phase Agent Harness for Auditing a Codebase, With the JSON-Schema-Verified Receipts to Match

Cloudflare open-sourced the 28,350-star skill that seeded the Project Glasswing vulnerability harness — a six-phase agent workflow (Recon, Hunt, Validate, Structured Output, Independent Re-verification, Target-Neutral Reporting) where findings are emitted against a JSON schema that is checked by a zero-dependency validator, hunter proposals cannot be self-graded, and a separate harness run on a different model has to re-verify the surviving records. The interesting bits are the trust-boundary hygiene (no-follow descriptor promotion, agent ID lowercase-locked to avoid case-fold collisions, scratch-only writes enforced at the OS level) and what that discipline did to Cloudflare's published numbers — 20,799 raw candidates collapsed to 7,245 actionable findings, 11% post-validate rejection rate, 25,472 wishlist writes since the fleet went live.

I went looking at cloudflare/security-audit-skill because the README’s first sentence is “A coding-agent skill that turns your agent into a security auditor” and the second is “This is the skill that seeded Cloudflare’s vulnerability discovery harness, described in Build your own vulnerability harness” — and the second post is the one that published the Project Glasswing numbers. 145 repos scanned, 13,841 findings in the central VVS, 25,472 wishlist writes, validation rejection rate down from 40% to 11%, lifecycle metric: a single run finds roughly half the bugs you’d catch across multiple runs. The skill is the single-repo starting point the fleet harness grew out of; the repo is a faithful record of that starting point.

The interesting part of the skill is not the model. It is the workflow discipline. A Hunter agent files a candidate as JSON. A fresh validator tries to disprove it from source. A second independent agent re-verifies the surviving records against the current main branch. The findings are emitted against a JSON schema that a zero-dependency Node script checks. The agent that runs target-controlled code is constrained by an OS-enforced sandbox that allows writes only to its own scratch directory; artifacts are promoted to retained storage by trusted parent-side code via a documented no-follow descriptor procedure. The promotion procedure is so strict it rules out symlinks, FIFOs, sockets, devices, directories, hard links, and “any file that exceeds its bound” — by design, because the alternative is letting a Hunter leak a finding whose evidence it just forged.

The skill is 117 KB of JavaScript, MIT licensed, 28,350 stars, 1,695 forks, 59 open issues, last commit 2026-09-14 (“Rework the audit workflow, findings contract, and validators end to end”). The current shape has been stable since the Sept 10 PR #12 “harden-audit-workflow-and-validators”. The default profile is standard. There is a quick profile for small targets and a deep profile for high-stakes ones. The skill operates in two modes — guidance (no files written, the agent answers a security question) and full audit (six phases, reports, findings.json) — and “If the request could mean either mode, ask one focused question before creating files.”

I am going to read the skill the way I would read a kernel: line by line, looking for the design decisions that prevent a category of failure, and the things that surprised me about how the security model is enforced.

The bet, in one sentence

The bet is that an agent harness for security auditing is, in the limit, a database, an orchestrator, and a JSON-schema-validated report — and the model is the part you should be most willing to swap. From the Cloudflare post: “Our approach centers on the harness, not the model. When it comes to vulnerability discovery, we run it with whatever frontier model is currently best at what we need. When we point different models at the same target, they each turn up a different share of the bugs. The harness is the bit that lasts.”

This is the same shape as the inference-engine story Magnitude tells, except for security. Magnitude’s Seismic compiler compiles and tunes per-device kernels for whatever model you load; Cloudflare’s harness runs the same six phases against whatever frontier model is leading. In both cases, the bet is on the layer that absorbs the volatility of upstream components. Magnitude’s layer is the 60-second compile budget. Cloudflare’s layer is the orchestrator that treats the model as a stateless compute engine.

What’s actually hard about agent-driven security

Three things, each of which a Hunter will get wrong if you do not enforce it:

  1. A Hunter will edit the source code so its own exploit works, then report the bug it just created. From the Cloudflare post: “It will write a test that proves something entirely tautological like ‘exec() executes things, therefore critical vulnerability’. Or it builds an exploit that runs fine but proves nothing, because the threat model behind it is nonsense.” The fix is that every confirmed finding ships with a PoC written as a test that runs against the original, untouched codebase. “If there is no working PoC, we treat the finding as fake.”
  2. A Hunter will confidently grade its own homework. “If a Hunter is allowed to grade its own homework, it will confidently validate everything it outputs.” The fix is mechanical: a Validator agent cannot log findings of its own. Its sole job is to aggressively disprove the Hunter’s theory. And a second, fresh agent re-verifies the surviving records against the current main.
  3. A crash mid-run costs hours of work. “Losing hours of work to one AI rate-limit error or connection flakiness is an incredibly expensive way to realize you need a better architecture.” The fix is that every stage writes to one SQLite database keyed by (run_id, repo, stage). Any stage can resume, retry, or get pulled into a later run without redoing work.

The skill bakes the first two into the workflow as JSON-schema-enforced contracts. The third is in the architecture (every stage writes to a single source of truth), not in any individual phase.

The mechanism, in one rule

The mechanism is the JSON schema in report-schema.json. Three verdict branches, all with additionalProperties: false:

  • confirmed — source-grounded, independently demonstrated. Required: verdict, fingerprint, title, description, root_cause, intended_behavior, trace, evidence, conditions, execution, remediation, severity, confidence. Must not use claimed_root_cause, blockers, validation_plan, or reason.
  • needs_validation — source-grounded candidate whose decisive validation is blocked. Required: verdict, fingerprint, title, description, claimed_root_cause, trace, evidence, blockers, validation_plan. Must not use severity, execution, remediation, reason, or confirmed root cause.
  • rejected — refuted during validation. Required: verdict, fingerprint, title, description, claimed_root_cause, trace, evidence, reason. Must not use severity, execution, remediation, blockers, validation plan, or confirmed root cause.

The schema is strict about which fields each verdict can carry, and the validator enforces the contract. A Hunter that wants severity on a needs_validation candidate is mechanically rejected. A Hunter that wants to log a finding without evidence is mechanically rejected. The Hunter’s prose opinion about a candidate never reaches the report — only the structured record that satisfies the schema.

The trace format is similarly constrained. A multi-step trace begins with entrypoint, ends with sink, and uses propagation only between them. One-entry traces use entrypoint or sink. Every trace step has kind, file, line, scope, description. Every evidence item has file, line, description. The validator does a fstat-like check on the line numbers: the line number must be positive, the file path must be present, and the description must contain visible content (a regex check that rejects whitespace-only or control-character-only strings).

confidence is not free-form. The Cloudflare team picks it after seeing the evidence. From the post: “We don’t claim a false-negative rate for our system. There’s no labeled set of every real bug in a codebase, so any claimed recall number is entirely speculative. What we can watch is whether re-runs keep turning up new bugs (they do) and whether coverage is still growing across runs.”

What the numbers actually show

The Cloudflare post published the lifetime numbers as of the time the post was written. Quoted verbatim:

  • 20,799 raw candidates generated by VDH
  • 12,057 findings survived validation and were pushed into the VVS, joining findings from another harness
  • Central pool brought to 13,841
  • 5,442 findings folded away as duplicates by the Dedup agent
  • 1,154 routed to the queue as “wrong-repo” or “low-risk” and recycled back
  • 7,245 actionable findings for engineering teams to act on

The validation rejection rate dropped from 40% to 11% as they tuned the Recon phase for better context injection. The share of “high-integrity” findings climbed from 35% to 58%, representing ~12,057 lifetime findings. A “realistic benchmark” on a single ~30k-line repo shows the cost shape: 100 initial findings after a 3-4 hour full run, compressed by Dedup and Judgment in 3 hours to 80 distinct high-fidelity bugs, fixed by the automated Fixer at 5 minutes per bug. The Fixer is the youngest and slowest part of the system — “it remains the youngest and slowest part of the system” — and a human must review every branch.

The wishlist has been written to 25,472 times across 128 repos since it was added. The post quotes one of those writes: “I need a FreeBSD VM to confirm this PoC end-to-end.” The wishlist is the main way the agents talk back to the human operators; some entries auto-resolve when a generic coding harness can monitor logs and rebuild a container, but most are explicit handoffs.

The Sibling Forking mechanism accounts for roughly 9% of fleet-wide tasks — but the rate is “highly model-dependent — from near-zero to about a fifth, depending on which model is hunting.” This is the version of “model X is best at task Y” that is actually useful: not a static leaderboard number, but a measured distribution over a real workload. The harness does not care which model does the work, but the work’s shape is shaped by the model. The interesting implication is that any “model is best at security” claim is incomplete without naming the harness underneath.

The cost shape is what you would expect: almost all the compute goes to the Hunt stage, each Gapfill pass costs about half as much as the initial hunt, and the budget is per-repo rather than per-run because the cost per repository varies wildly. They run 50 to 200 workers in parallel against 145 repos. The worst full scan of a complex repo took just over 14 hours. “It’s also why, for us, the big scans are a periodic backlog sweep and not a per-PR check. A full scan of a complex repo can take hours; the worst run took just over 14 hours. Cheaper, smaller harnesses are the right tool for that job.”

Trade-offs and what the skill does not fix

The skill does not address three categories of failure, and knowing where it stops is part of the point.

The skill is single-target. The harness has cross-repo tracing, but the skill does not. Cloudflare’s post is explicit: “Skip a dedicated Deduplication agent until you are actively drowning in noise. Start with a skill in your development environment, get your prompts working well, and only build the next architectural stage when not having it is the specific thing slowing you down.” The lesson is that the skill is the minimum viable harness. A team that copy-pastes the skill into a multi-repo scanner will hit dedup, persistence, and trace problems on day one. The skill does not pretend to solve those.

The skill’s confirmed boundary is the source line. A confirmed finding requires a source-grounded, bounded-local-evidence invariant failure. The skill explicitly says that a confirmed finding must not use claimed_root_cause, blockers, validation_plan, or reason — and that needs_validation records cannot have severity. This is the right shape, but it pushes a category of work outside the system: deployment-context vulnerabilities whose boundary depends on a provider, proxy, browser, or identity system that is not in the source. Those become needs_validation records with an exact unresolved blocker. The skill is honest about this; the published number “11% rejected at validation” is the share of candidates whose threat model, exploit path, affected code, or evidence was disproved, not the share of candidates whose deployment context was uncertain. The trade-off is that deployment-context bugs sit in the VVS queue rather than the engineering queue, and a human triages them with the Judgment agent. The harness absorbs the ambiguity; the operator carries it.

The skill’s discipline does not generalize to other agent workflows. The same level of evidence-binding is overkill for, say, a content-generation agent. The cost of the schema is justified by the cost of false positives in security; it is not justified for every agent. The post itself warns against building the next architectural stage when you don’t need it: the team explicitly did not plumb Semgrep through the Hunters, and the Hunters invoked it zero times in a month of runs. “It’s worth paying attention to what the agents actually reach for, rather than what you think they’ll want.”

The skill is also opinionated about the model. The VDH runs on one model; the VVS runs on a “completely different” model, so the two layers cross-check each other. “By forcing Model B (VVS) to judge the output of Model A (VDH), you ensure that the finding is evaluated by an entirely different set of logical weights and training data.” This is a strong claim, and it depends on the two models actually being “different” in a way that matters — not just different vendors, but different training distributions. A team that runs the same model on both sides gets a more uniform output and loses the cross-check. The skill does not enforce model-level separation; it enforces the workflow that makes model-level separation valuable.

The promotion procedure, in detail

The most unusual thing in the skill is the artifact promotion procedure. It is duplicated verbatim in SKILL.md, HUNTING.md, and VALIDATION-AND-REPORTING.md because every agent prompt needs to know it. The procedure is for trusted parent-side code only — the Hunter or Verifier never runs it. After the sandbox terminates, the parent promotes each predeclared scratch-relative file separately. The 11-step procedure is exact enough to be a real implementation contract:

  1. Validate the declared relative path: reject absolute, empty, ., .., or symlinked components.
  2. Walk each parent component from the retained scratch-root descriptor with no-follow directory-relative operations; never reopen by path.
  3. Open the leaf no-follow and nonblocking.
  4. Verify with fstat that it is a regular file with link count exactly one and within the recorded per-file and cumulative byte limits.
  5. Enforce those limits again while reading from that descriptor.
  6. Copy exactly the verified size, repeat fstat, and reject a changed identity, type, link count, or size.
  7. For the destination, walk every parent component from the retained artifacts-root descriptor with no-follow directory-relative operations; require each existing component to be a real directory, and create any missing directory exclusively before reopening and verifying it no-follow.
  8. Create the leaf exclusively without following links, verify that the opened destination is a regular file with link count exactly one, and copy from the verified source descriptor without reopening either path.
  9. Use equivalent race-safe APIs on non-POSIX systems.
  10. Never recursively copy or glob scratch, extract an archive into artifacts, or open or promote a symlink, FIFO, socket, device, directory, hard-linked file, changing file, or file that exceeds its bound.
  11. If any check is unavailable, cannot be enforced, or fails, discard the scratch entry; if it is decisive evidence, retain needs_validation with the exact promotion blocker.

The point is that every step the parent takes is on a pre-opened, non-inheritable file descriptor, not a path. The Hunter never sees the descriptor. The Hunter can only write to its own scratch directory, and the parent’s promotion code only ever opens files via the no-follow descriptor traversal. A Hunter that writes a symlink to /etc/passwd and names it evidence.txt cannot get the parent to open /etc/passwd by path, because the parent’s open call goes through the descriptor that the parent opened as agents/<hunter-id>/scratch/evidence.txt, and the parent’s fstat will see that the leaf is a symlink and reject it. The Hunter would have to write a regular file (not a symlink) whose contents were a real evidence artifact, and the byte limits cap the size.

The design is paranoid in the same way the kernel is paranoid about TOCTOU. The trade-off is that a Hunter that wants to forge evidence has to subvert the OS-level sandbox and the parent’s no-follow promotion at the same time. The published number — 11% post-validate rejection, 35% to 58% high-integrity share — is the empirical result of that design.

What the validator catches

The validate-findings.cjs script is a 28 KB zero-dependency Node module. It implements the JSON-Schema keywords used by report-schema.json (a documented subset) and adds finding-specific checks the authors thought were clearer in code. The schema allows additionalProperties: false per record, so any extra field on a confirmed/needs_validation/rejected record is mechanically rejected. The LIMITS constants cap the input at 5 MiB, 64 nesting levels, 1,000 top-level findings, 1024 KB canonical keys, 5 MB unique sets, and 100 reported validation errors. The script caps reported error output at 100 messages.

The script’s VISIBLE_CONTENT regex is /[^\p{White_Space}\p{Cc}\p{Cf}\p{Default_Ignorable_Code_Point}]/u — every required string must contain at least one non-whitespace, non-control, non-format, non-default-ignorable code point. Empty strings, whitespace-only strings, and strings of only zero-width characters are rejected. This is the kind of check that turns “looks fine to the human reviewer” into “the schema literally cannot describe a missing field as present.”

The validator’s SEVERITY_RANK ranks informational: 0, low: 1, medium: 2, high: 3, critical: 4. The skill’s documentation says “Overall severity cannot exceed demonstrated impact,” and the schema’s additionalProperties: false per verdict branch means a Hunter cannot smuggle severity into a needs_validation record. The Validator is structurally incapable of accepting a finding whose severity is disproportionate to the demonstrated impact.

The thing the README doesn’t tell you

The README is 6,950 bytes — short enough to read in one sitting. It does not tell you how the six phases compose into a real run. The blog post does: Recon runs three parallel research agents that write architecture.md; Hunt runs one Hunter per attack class with sibling forking enabled; Validate runs in two passes (a deterministic schema/path check, then a single isolated Verifier that tries to disprove the finding); Gapfill enqueues new hunt tasks for empty (area × attack-class) cells; Dedup clusters findings by root cause in real time; Trace walks the dependency graph to add hunt tasks inside consumer repos; Feedback rewrites queued prompts based on validation failures and shallow runs. The architecture summary in architecture.md is capped at “about 1,000 words,” and the assignment-level ordinary block, selected companion blocks, and excluded blocks with reasons stay in each ledger unit, not in the architecture summary, so the cap stays valid for large runs.

The run-metadata.json is the first file the parent writes. It carries run_id, repo, target, source_ref, profile, scope_paths, budget (null if unset), execution_policy: "sandboxed-source-and-local-only", the selected companion files, prior-run paths, shared-file owners, and run_status: "in_progress". The parent updates it only when those facts change; candidate state lives in findings.json and coverage-ledger.json. The cost of getting this wrong is silent: a Hunter that runs without a run_id writes evidence to a scratch directory the parent never tracks, and the run ends with a “successful” report and zero promoted artifacts. The post-mortem is the parent realizing the report is empty.

The Deterministic coverage ledger is the next file the parent writes. It is a top-level JSON array. One unit per material combination of entry surface, trust boundary, subsystem, and applicable ordinary or companion attack class. For a scoped run, the parent seeds in-scope surfaces for assignment and retains discovered excluded surfaces as out_of_scope units. Each unit has coverage_id, canonical_refs (with surface, boundary, subsystem, attack_class, optional lifecycle), starting_paths, ordinary_attack_class_block, selected_companion_blocks, excluded_blocks (with reasons), prior_status (one of eleven named values, including prior_confirmed_same_source, prior_confirmed_changed_source, prior_needs_validation, prior_deferred, prior_blocked, prior_out_of_scope, prior_covered_same_source, prior_covered_changed_source, prior_rejected_claim_changed, none), attempts (append-only archive), wave, status, agent_id, reviewed_paths, local_checks, result_fingerprints, unresolved.

The coverage_id derivation is one of the more interesting parts of the design. The skill does not allow lossy slugs. Every reference is Unicode NFC with valid scalar values, no control/format/line-separator code points, and no surrounding whitespace. UTF-8 bytes are RFC 3986 percent-encoded; only A-Z a-z 0-9 - . _ ~ are unescaped. The encoded surface, boundary, subsystem, and attack_class references are joined with ::, and an encoded lifecycle is appended when present. The validator rejects duplicate IDs and one semantic tuple represented by different canonical references. The point is that a Hunter that says “this is the same bug as last time” cannot lie about the coverage identity — the validator will say the IDs are different or the references are inconsistent, and the parent has to reconcile the claim.

The agent ID rules are similarly constrained. Canonical agent IDs match ^[a-z0-9][a-z0-9_-]{0,63}$ and must not equal a Windows device name such as con, prn, aux, nul, com1 through com9, or lpt1 through lpt9. Lowercase IDs prevent case-fold collisions. The skill explicitly says “Lowercase is mandatory, so one ledger cannot contain case-fold aliases.” This is a small thing that catches a real class of bug on Windows-based runtimes; on POSIX-only runtimes it looks paranoid, but the skill ships with the rule anyway.

What I am taking from this

I read this skill the way I read validate-findings.cjs itself: as a record of the design decisions a team made when they had to ship a system that has to keep working when the model changes. The thing I am taking is the schema-as-source-of-truth pattern. The schema is not a check at the end of the pipeline; it is the contract that the pipeline writes against. The Hunter cannot file a finding that does not satisfy the schema, the Validator cannot promote a finding that does not satisfy the schema, the Reporter cannot render a finding that does not satisfy the schema, and the Fixer cannot act on a finding that does not satisfy the schema. The schema is the API between every stage.

The companion model is also worth noting. The skill ships with twelve companion files in skills/security-audit/: RECONNAISSANCE.md, HUNTING.md, ATTACK-CLASSES.md, MEMORY-SAFETY-AND-BINARY.md, AI-AND-LLM.md, WEB-PROTOCOL-AND-AUTH.md, CLIENT-SIDE.md, SUPPLY-CHAIN-AND-RELEASE.md, CLOUD-AND-DEPLOYMENT.md, PROTOCOLS-RPC-AND-MESSAGING.md, RESOURCE-EXHAUSTION-AND-AVAILABILITY.md, DATA-ISOLATION-AND-LIFECYCLE.md, DESKTOP-MOBILE-AND-LOCAL-IPC.md, plus the validators and the schema. Each companion is a domain-specific block the parent selects based on the target’s reconnaissance. A RAG-heavy target gets AI-AND-LLM.md and WEB-PROTOCOL-AND-AUTH.md; a kernel module gets MEMORY-SAFETY-AND-BINARY.md; an HTTP-heavy API gets WEB-PROTOCOL-AND-AUTH.md and CLOUD-AND-DEPLOYMENT.md. The companions are not optional reading — they are sent to the Hunter verbatim, and the Hunter prompt specifies which sections to include. The parent does not summarize the companion for the Hunter; the parent quotes the exact sections, and the Hunter reasons over the verbatim text.

The post-mortem on the 40% to 11% validation rejection rate is the most useful number for anyone building a similar system. The post attributes the improvement to “better context injection from our Recon phase.” That is, the same Hunter, given better context about the target’s architecture, produces fewer candidates the Validator can disprove. The skill is the substrate; the context quality is the multiplier. The same six phases, with worse context, give you the 40% rate. The same six phases, with better context, give you the 11% rate. The skill does not solve the context-quality problem; it gives you a measurement framework that lets you tell when the context has improved.

Final paragraph

The skill is the single-repo starting point that became the 145-repo fleet. The published numbers are real and traceable through the JSON schema. The trust-boundary hygiene is unusually careful for a 117 KB JavaScript project. I am not going to install it on a production target without first reading the validators in detail and verifying that the no-follow descriptor promotion is actually implemented in my runtime — but I am also not going to write a similar system without at least reading the schema and the promotion procedure, because the design decisions in this skill are the right design decisions, and the work of building the next architectural stage is mostly the work of replicating them with a different model in the loop.

References and where to dig further

  • cloudflare/security-audit-skill — the skill repo, MIT, 28,350 stars. skills/security-audit/SKILL.md is the entry point; skills/security-audit/report-schema.json is the schema; validate-findings.cjs and validate-coverage-ledger.cjs are the zero-dependency validators.
  • Build your own vulnerability harness — the Cloudflare blog post that published the fleet numbers (20,799 raw candidates, 12,057 survived validation, 13,841 in VVS, 5,442 duplicates folded, 7,245 actionable, 25,472 wishlist writes, 11% post-validate rejection rate, 50-200 worker pool, worst run 14 hours).
  • skills/security-audit/AI-AND-LLM.md — the companion for AI/LLM/agent targets. Includes the “Prompt injection alone is not a finding” core discipline and the seven attack-class blocks (Context, retrieval, memory; Tool and action; MCP and sub-agent; Output and disclosure). The MCP and sub-agent section is the one I would read first if I were auditing a tool-calling agent.
  • skills/security-audit/report-schema.json — the schema. Three verdict branches (confirmed, needs_validation, rejected) with strict per-branch required field lists and additionalProperties: false. The schema is the API between every stage of the pipeline.
  • skills/security-audit/SKILL.md — the Operating modes section. Guidance mode is the default; full audit mode requires explicit user request. “If the request could mean either mode, ask one focused question before creating files.”
Aniket Karne
DevOps & AI Engineer · Amsterdam
Back to all posts
Reader correspondence

Comments

Powered by GitHub Discussions via Giscus. Sign in with GitHub to leave a comment.