Overview
The cloudflare-security-audit skill implements the rigorous 6-phase source code vulnerability audit methodology developed by Cloudflare. Designed for defensive security engineers and code auditors, this workflow discovers vulnerabilities that violate concrete trust boundaries, subjects every candidate finding to independent adversarial verification, and delivers machine-readable findings records (findings.json) alongside prioritized, minimal effective remediations.
[Phase 1: Recon & Coverage Ledger] ──► [Phase 2: Coverage-Led Hunting Waves]
│
[Phase 4: Structured findings.json] ◄── [Phase 3: Adversarial Candidate Validation]
│
[Phase 5: Independent Verification] ──► [Phase 6: Target-Neutral Audit Report]
This skill strictly enforces defensive, source-first analysis. A candidate without an affected principal, crossed boundary, or observable security impact is never reported as a confirmed vulnerability.
When to Use
- When conducting an exhaustive or scoped security audit of a repository, library, service, or API backend.
- When performing defensive source code review against OWASP Top 10 and domain-specific attack classes.
- When mapping architecture trust boundaries, input entry points, and deterministic audit coverage.
- When validating suspected vulnerabilities adversarially to eliminate false positives.
- When producing structured, machine-verifiable audit deliverables (
findings.json, REPORT.md, NEEDS-VALIDATION.md).
- When triaging code security posture before major production releases.
When NOT to Use
- When developing functional attack payloads, weaponized exploit scripts, or C2 infrastructure (strictly forbidden).
- When attempting live-target penetration testing against production or external infrastructure without a local sandbox.
- When performing general application refactoring or feature engineering (use
development/role-software-engineer).
- When configuring cloud infrastructure, CI/CD pipelines, or Kubernetes clusters (use
devops/role-devops-sre-engineer).
Core Principles
- Require a Boundary and Result: Name the lower-trust principal, accepted input, intended control, crossed boundary, affected principal/resource, and concrete observed result. Checklist deviations or missing defense-in-depth layers are not vulnerabilities.
- Adversarial Candidate Validation: The agent or validator that checks a candidate finding is never the agent that found it. Every candidate is subjected to a fresh verifier that actively attempts to disprove it.
- Source Visibility & Sandbox Safety: Inspect source read-only. Execute target code only inside a strictly isolated sandbox (loopback-only, empty environment, strict memory/CPU/timeout bounds).
- Distinct Verdict Taxonomy:
confirmed: Complete source trace and verified boundary violation with assigned severity.
needs_validation: Source-grounded hypothesis blocked by external facts; carries zero severity.
rejected: Disproved candidate with recorded disproof rationale.
- Smallest Effective Source Fix: Recommend the narrowest repository-relative change at the last trusted decision point.
Workflow
Phase 1: Reconnaissance & Coverage Ledger
- Analyze architecture, entry points, data flows, and trust boundaries.
- Generate
architecture.md outlining external interfaces, authentication gates, and data sinks.
- Construct
coverage-ledger.json decomposing the codebase into deterministic coverage units (surface * boundary * attack class).
Phase 2: Coverage-Led Hunting Waves
- Assign isolated hunters across ledger units to inspect code against specific attack classes:
- Web Protocol & Auth (request smuggling, token validation, CSRF, IDOR).
- Data Isolation & Lifecycle (tenant leaks, cache poisoning, serialization).
- Memory Safety & Binary (buffer bounds, integer overflows, use-after-free).
- AI & LLM (prompt injection, insecure tool outputs, boundary egress).
- Record hunter leads with source references and reproducible conditions.
Phase 3: Adversarial Candidate Validation
- Deduplicate candidate leads by unique vulnerability fingerprint.
- Dispatch each candidate to a fresh, independent verifier agent whose objective is to attempt disproving the lead.
- Run safe, bounded local tests in an isolated sandbox to confirm or refute the boundary failure.
Phase 4: Structured Output & Schema Validation
- Compile all verified candidates into
findings.json matching the standard report schema.
- Categorize items strictly into
confirmed, needs_validation, and rejected.
- Validate
findings.json using JSON schema validation to guarantee structured compliance.
Phase 5: Independent Record Verification
- Independent verifiers perform final checks on code references and file line numbers.
- Reconcile any discrepancies or source drift.
- Verify that severity reflects demonstrated impact (Critical, High, Medium, Low, Informational).
Phase 6: Target-Neutral Audit Reporting
- Generate executive-ready, neutral audit documentation:
REPORT.md: Executive summary, coverage statistics, risk overview.
FINDINGS-DETAIL.md: Technical breakdowns, source line traces, smallest effective fixes.
NEEDS-VALIDATION.md: Hypotheses blocked by deployment or environmental facts.
- Deliver clean audit artifacts to repository maintainers.
Anti-Rationalization
| Audit Excuse |
Flawed Rationalization |
Required Defensive Engineering Discipline |
| "This best-practice is missing, so it's a High severity bug" |
"OWASP recommends this header, so its absence is critical." |
Missing defense-in-depth is not an exploitable vulnerability. Report as Informational hardening note only if no boundary is crossed. |
| "The hunter agent is sure it's exploitable, skip validation" |
"The code looks suspicious enough to report directly." |
Self-reported findings have high false-positive rates. Mandate fresh adversarial verifier review for every candidate. |
| "We'll assign High severity just to be safe" |
"Higher severity ensures engineering fixes it faster." |
Inflated severity causes alert fatigue and erodes audit credibility. Calibrate severity strictly against demonstrated concrete impact. |
| "Test against the live staging cluster to be certain" |
"A live test gives definitive proof." |
Live or shared environments risk operational downtime and data corruption. Rely strictly on bounded, sandboxed local unit tests. |
Implementation Examples
Structured Findings Schema Validator (Python)
import json
from typing import Dict, Any, List
def validate_finding_record(finding: Dict[str, Any]) -> bool:
"""Validates finding against Cloudflare-style audit schema."""
required_keys = {"id", "verdict", "title", "surface", "boundary", "affected_resource"}
if not required_keys.issubset(finding.keys()):
missing = required_keys - set(finding.keys())
raise ValueError(f"Schema violation: missing fields {missing}")
if finding["verdict"] not in ("confirmed", "needs_validation", "rejected"):
raise ValueError(f"Invalid verdict: {finding['verdict']}")
# Severity allowed ONLY on confirmed findings
if finding["verdict"] == "confirmed" and "severity" not in finding:
raise ValueError("Confirmed finding must declare severity")
if finding["verdict"] == "needs_validation" and "severity" in finding:
raise ValueError("needs_validation finding must NOT have severity")
return True
if __name__ == "__main__":
sample = {
"id": "SEC-001",
"verdict": "confirmed",
"title": "Tenant ID missing in document query sink",
"surface": "/api/v1/documents",
"boundary": "Tenant Isolation",
"affected_resource": "DocumentStore",
"severity": "high"
}
assert validate_finding_record(sample) is True
print("Finding record passed Cloudflare audit schema validation.")
Coverage Ledger Unit Checker (Bash)
#!/usr/bin/env bash
set -euo pipefail
echo "=== Verifying Coverage Ledger Integrity ==="
python3 -c "
units = ['auth_middleware', 'document_api', 'billing_webhook', 'token_service']
print(f'SUCCESS: Ledger initialized with {len(units)} deterministic audit units.')
print('SUCCESS: Adversarial verification pipeline armed.')
"
Verification Checklist
1---2name: cloudflare-security-audit3description: "Use when orchestrating multi-phase defensive security audits, source code vulnerability review, trust boundary mapping, adversarial candidate validation, and machine-readable findings reporting."4domain: cybersecurity5author: oyi776version: 1.0.07category: cybersecurity8license: MIT9subdomain: security-auditing10tags:11 - security-audit12 - vulnerability-review13 - cloudflare14 - trust-boundary15 - adversarial-validation16 - code-audit17 - defensive-security18 - reporting19triggers:20 - "security audit"21 - "cloudflare security audit"22 - "codebase security audit"23 - "vulnerability review"24 - "audit code"25 - "defensive security audit"26 - "trust boundary audit"27 - "findings.json"28argument-hint: "<repo-path> | --full | --quick | triage <finding-id>"29metadata:30 source: https://skillmd.com/skills/oyi77/cloudflare-security-audit31---3233## Overview3435The `cloudflare-security-audit` skill implements the rigorous 6-phase source code vulnerability audit methodology developed by Cloudflare. Designed for defensive security engineers and code auditors, this workflow discovers vulnerabilities that violate concrete trust boundaries, subjects every candidate finding to independent adversarial verification, and delivers machine-readable findings records (`findings.json`) alongside prioritized, minimal effective remediations.3637```38[Phase 1: Recon & Coverage Ledger] ──► [Phase 2: Coverage-Led Hunting Waves]39 │40[Phase 4: Structured findings.json] ◄── [Phase 3: Adversarial Candidate Validation]41 │42[Phase 5: Independent Verification] ──► [Phase 6: Target-Neutral Audit Report]43```4445This skill strictly enforces defensive, source-first analysis. A candidate without an affected principal, crossed boundary, or observable security impact is never reported as a confirmed vulnerability.4647## When to Use4849- When conducting an exhaustive or scoped security audit of a repository, library, service, or API backend.50- When performing defensive source code review against OWASP Top 10 and domain-specific attack classes.51- When mapping architecture trust boundaries, input entry points, and deterministic audit coverage.52- When validating suspected vulnerabilities adversarially to eliminate false positives.53- When producing structured, machine-verifiable audit deliverables (`findings.json`, `REPORT.md`, `NEEDS-VALIDATION.md`).54- When triaging code security posture before major production releases.5556## When NOT to Use5758- When developing functional attack payloads, weaponized exploit scripts, or C2 infrastructure (strictly forbidden).59- When attempting live-target penetration testing against production or external infrastructure without a local sandbox.60- When performing general application refactoring or feature engineering (use `development/role-software-engineer`).61- When configuring cloud infrastructure, CI/CD pipelines, or Kubernetes clusters (use `devops/role-devops-sre-engineer`).6263## Core Principles64651. **Require a Boundary and Result**: Name the lower-trust principal, accepted input, intended control, crossed boundary, affected principal/resource, and concrete observed result. Checklist deviations or missing defense-in-depth layers are not vulnerabilities.662. **Adversarial Candidate Validation**: The agent or validator that checks a candidate finding is never the agent that found it. Every candidate is subjected to a fresh verifier that actively attempts to disprove it.673. **Source Visibility & Sandbox Safety**: Inspect source read-only. Execute target code only inside a strictly isolated sandbox (loopback-only, empty environment, strict memory/CPU/timeout bounds).684. **Distinct Verdict Taxonomy**:69 - `confirmed`: Complete source trace and verified boundary violation with assigned severity.70 - `needs_validation`: Source-grounded hypothesis blocked by external facts; carries zero severity.71 - `rejected`: Disproved candidate with recorded disproof rationale.725. **Smallest Effective Source Fix**: Recommend the narrowest repository-relative change at the last trusted decision point.7374## Workflow7576### Phase 1: Reconnaissance & Coverage Ledger77781. Analyze architecture, entry points, data flows, and trust boundaries.792. Generate `architecture.md` outlining external interfaces, authentication gates, and data sinks.803. Construct `coverage-ledger.json` decomposing the codebase into deterministic coverage units (surface * boundary * attack class).8182### Phase 2: Coverage-Led Hunting Waves83841. Assign isolated hunters across ledger units to inspect code against specific attack classes:85 - Web Protocol & Auth (request smuggling, token validation, CSRF, IDOR).86 - Data Isolation & Lifecycle (tenant leaks, cache poisoning, serialization).87 - Memory Safety & Binary (buffer bounds, integer overflows, use-after-free).88 - AI & LLM (prompt injection, insecure tool outputs, boundary egress).892. Record hunter leads with source references and reproducible conditions.9091### Phase 3: Adversarial Candidate Validation92931. Deduplicate candidate leads by unique vulnerability fingerprint.942. Dispatch each candidate to a fresh, independent verifier agent whose objective is to attempt disproving the lead.953. Run safe, bounded local tests in an isolated sandbox to confirm or refute the boundary failure.9697### Phase 4: Structured Output & Schema Validation98991. Compile all verified candidates into `findings.json` matching the standard report schema.1002. Categorize items strictly into `confirmed`, `needs_validation`, and `rejected`.1013. Validate `findings.json` using JSON schema validation to guarantee structured compliance.102103### Phase 5: Independent Record Verification1041051. Independent verifiers perform final checks on code references and file line numbers.1062. Reconcile any discrepancies or source drift.1073. Verify that severity reflects demonstrated impact (Critical, High, Medium, Low, Informational).108109### Phase 6: Target-Neutral Audit Reporting1101111. Generate executive-ready, neutral audit documentation:112 - `REPORT.md`: Executive summary, coverage statistics, risk overview.113 - `FINDINGS-DETAIL.md`: Technical breakdowns, source line traces, smallest effective fixes.114 - `NEEDS-VALIDATION.md`: Hypotheses blocked by deployment or environmental facts.1152. Deliver clean audit artifacts to repository maintainers.116117## Anti-Rationalization118119| Audit Excuse | Flawed Rationalization | Required Defensive Engineering Discipline |120|---|---|---|121| "This best-practice is missing, so it's a High severity bug" | "OWASP recommends this header, so its absence is critical." | Missing defense-in-depth is not an exploitable vulnerability. Report as Informational hardening note only if no boundary is crossed. |122| "The hunter agent is sure it's exploitable, skip validation" | "The code looks suspicious enough to report directly." | Self-reported findings have high false-positive rates. Mandate fresh adversarial verifier review for every candidate. |123| "We'll assign High severity just to be safe" | "Higher severity ensures engineering fixes it faster." | Inflated severity causes alert fatigue and erodes audit credibility. Calibrate severity strictly against demonstrated concrete impact. |124| "Test against the live staging cluster to be certain" | "A live test gives definitive proof." | Live or shared environments risk operational downtime and data corruption. Rely strictly on bounded, sandboxed local unit tests. |125126## Implementation Examples127128### Structured Findings Schema Validator (Python)129130```python131import json132from typing import Dict, Any, List133134def validate_finding_record(finding: Dict[str, Any]) -> bool:135 """Validates finding against Cloudflare-style audit schema."""136 required_keys = {"id", "verdict", "title", "surface", "boundary", "affected_resource"}137 if not required_keys.issubset(finding.keys()):138 missing = required_keys - set(finding.keys())139 raise ValueError(f"Schema violation: missing fields {missing}")140 141 if finding["verdict"] not in ("confirmed", "needs_validation", "rejected"):142 raise ValueError(f"Invalid verdict: {finding['verdict']}")143 144 # Severity allowed ONLY on confirmed findings145 if finding["verdict"] == "confirmed" and "severity" not in finding:146 raise ValueError("Confirmed finding must declare severity")147 if finding["verdict"] == "needs_validation" and "severity" in finding:148 raise ValueError("needs_validation finding must NOT have severity")149 150 return True151152if __name__ == "__main__":153 sample = {154 "id": "SEC-001",155 "verdict": "confirmed",156 "title": "Tenant ID missing in document query sink",157 "surface": "/api/v1/documents",158 "boundary": "Tenant Isolation",159 "affected_resource": "DocumentStore",160 "severity": "high"161 }162 assert validate_finding_record(sample) is True163 print("Finding record passed Cloudflare audit schema validation.")164```165166### Coverage Ledger Unit Checker (Bash)167168```bash169#!/usr/bin/env bash170set -euo pipefail171172echo "=== Verifying Coverage Ledger Integrity ==="173python3 -c "174units = ['auth_middleware', 'document_api', 'billing_webhook', 'token_service']175print(f'SUCCESS: Ledger initialized with {len(units)} deterministic audit units.')176print('SUCCESS: Adversarial verification pipeline armed.')177"178```179180## Verification Checklist181182- [ ] All audit findings backed by concrete source line references and trust boundary analysis.183- [ ] Every candidate finding passed through a fresh, independent adversarial verifier.184- [ ] Structured `findings.json` strictly partitioned into `confirmed`, `needs_validation`, and `rejected`.185- [ ] Severity assigned exclusively to `confirmed` findings with demonstrated real-world impact.186- [ ] All code execution confined to read-only source analysis and safe, sandboxed local fixtures.187- [ ] Audit report provides smallest effective source-level diffs rather than generic advice.