oss-fuzz-coverage-pipeline
Use this skill to bring a project that is already integrated into OSS-Fuzz (C/C++, Go, Rust, JVM or Python) to a well-fuzzed state: fix broken builds, triage live coverage, improve fuzz targets, and add corpora and dictionaries only where a proven mutation-resistant gate justifies them, then deliver the work as worktree branch duo pairs. Never commits, never pushes and by default never stages. Selects projects by name, glob pattern or all projects, verifies upstream viability from the Dockerfile, auto-detects the language from project.yaml and activates the matching language skill. Processes one project at a time via a run manifest.
OSS-Fuzz coverage pipeline
End-to-end pipeline for an already-integrated OSS-Fuzz project (any language with a dedicated fuzzing skill) whose fuzzing is broken or weak. The goal is that the project's own security-sensitive code is reachable and actually exercised by fuzz targets, and that the work is delivered as worktree branch duo pairs that a human can review, commit and push.
This skill is a process wrapper. It defines what to do and in which order; it deliberately does not re-teach the underlying knowledge. While working through the phases you MUST also use:
- oss-fuzz-engineer, always: OSS-Fuzz infrastructure, builds,
infra/helper.py, project layout, public build status and coverage data. - the language-appropriate fuzzing skill, auto-determined from each project's
project.yamllanguagefield, which is the sole source of truth for the language. The Dockerfile base image is toolchain compatibility only and is never a language signal: a C++ project with a Rust module may legitimately sit on the rust base image.
project.yaml language | Sub-skill to activate |
|---|---|
c, c++, or missing | fuzzing-memory-unsafe-expert |
go | fuzzing-go-expert |
rust | fuzzing-rust-expert |
jvm | fuzzing-jvm-expert |
python | fuzzing-python-expert |
| other (javascript, swift, ruby, ...) | none dedicated: rely on oss-fuzz-engineer, or scope the run with --language |
- fuzzing-coverage-targeting, in Phases 2, 3 and 5: which targets are worth harnessing and what shape each harness takes (worth model, dark-region taxonomy, harness patterns, portfolio cap and overlap rules).
plus their references (code_coverage.md, structured_seed_generation.md, helper.md, oss_fuzz_project_structure.md) where pointed to below — loaded on demand, targeted to the section a phase needs, never as bulk pre-reading (see Context discipline).
Hard guardrails
- Never
git commitand nevergit push, in either repository: this is strictly forbidden. Staging (git add) is also skipped by default. Leave changes as plain working-tree files (modified or untracked), and stage only when it is absolutely necessary for the task, recording why in the report. If a commit happens by accident, stop immediately and notify the user; never try to quietly undo it. - Every build, check, run and coverage measurement goes through
python3 infra/helper.pyinside the OSS-Fuzz Docker environment. Never validate with bare local toolchains (direct clang, cmake, cargo, gradle and the like). Reading and inspecting cloned source locally is fine. - The worktree duo pairs hold the only copies of the work. Do not run destructive git commands inside a worktree, and do not delete worktrees; rejected pairs are moved to the rejected area, never deleted.
- Every claim of improvement must be backed by a measurement: build success, fuzzer run output or coverage numbers. No measurement, no claim.
- Fresh data on every run: whenever this skill determines any project data, treat it as a new check and never rely on memory from previous runs. Reread
project.yaml(language, sanitizers, engines,main_repo), the Dockerfile, the build status, the coverage report pointers and the upstream state on every run. If a project's language changed since an earlier run (for example C++ to Rust), the new run must see the new value and select the sub-skill accordingly. The manifest carries process state (what is done and pending), not world facts: when a fresh read contradicts something recorded earlier, the fresh read wins and the manifest row is corrected. This matters most on reruns: a project may have been updated by a previous batch of duo pairs (merged and since picked up by production), so earlier coverage data, target lists and assumptions no longer hold. A second run re-derives everything from fresh data and treats earlier findings, including which code was dark or already covered, as history rather than truth. - Upstream product code is off-limits: never modify the upstream project's own source code. Bugs in it are findings (documented, filed by the user), never fixes by the agent. The only permitted upstream changes are: fuzzers (harnesses and their corpora, dictionaries and options), fuzz build configuration (wiring the targets into the build), and additions guarded by the
FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTIONmacro, which is the sole sanctioned product-code edit (the macro is set in OSS-Fuzz builds and is the standard way to make behaviour fuzz-friendly without affecting production). If product code gets modified by accident, stop immediately and notify, never quietly undo. The OSS-Fuzz repo side (Dockerfile,build.sh,project.yaml) is not affected by this rule. - Classify every post-build crash; never silence: a crash, memleak, OOM or timeout after a successful build, whether it surfaces in
check_buildor in the fuzzing runs, is never an automatic failure: classify it first (procedure in the worktree reference). Fuzzer faults consume the fix budget; real findings keep the pair delivered with the discovery marked and consume nothing. Never introduce new silencing (no leak-detection muting, no suppression flags or files, no raised limits to dodge a failure). Pre-existing suppressions in the existing integration or existing fuzzers are honoured unchanged: carried over for new and fixed fuzzers, neither removed nor widened, and only what they already cover is out of scope. - Precedence: these guardrails and this skill's rules override any conflicting guidance in the sub-skills; the sub-skills supply craft and knowledge within these bounds.
Context discipline (every phase)
The pipeline is long and build-heavy; context is a budget like disk or time, and running out of it loses work. These rules are mandatory in every phase, and they matter most exactly when pressure tempts the opposite.
- Load knowledge lazily and targeted. Sub-skills and references are read on demand, for the phase that needs them: a bounded search or a line-ranged read of the operative section, never a bulk pre-read of every skill, reference and source file before the first deliverable exists.
- Big data never crosses the chat. Coverage reports,
summary.json,status.json, introspector pages and logs are downloaded to disk (curl -fsSL -o <file>, orinfra/helper.py ... > <log>) and reduced with a localpython3/jqone-liner that prints only the numbers needed (scripts/select_projects.shshows the pattern). Never pull raw JSON, HTML or a full log through a fetch tool, and nevercata large file into context. - Bound every output. Cap every search and read:
grep -m,head -c/tail -c, explicit line ranges. No unbounded dumps (limitlessgrep -B/-A, full-filesed -nprints, full log tails), and a file already on disk is never re-read "to be sure". - Background long builds; poll, never wait. Builds and gate runs run in the background with output redirected to a log file, polled with one short bounded command (
tail -c 300 <log>) at short intervals. A multi-minute foregroundsleepburns a full result slot. A failure costs one bounded extraction of the error region (firsterror:or sanitizer summary plus a few lines), never a whole-log re-read. - Small, anchored, verified edits. Keep every edit under ~4000 characters; take anchors from a fresh small read of the exact region immediately before editing, and verify the result with a bounded grep right after. Never do string surgery on code with
sed(one unescaped metacharacter silently mangles a file and costs a whole debug cycle); use a smallpython3 -creplacement or rewrite the small file whole. - Checkpoint after every completed step, not just every phase. The manifest row, plan and coverage ledger are updated immediately after each step (pair staged, fix applied, build or gate result, decision taken), so an eviction or a fresh session recovers with one small manifest read plus bounded verification (
git diff --stat,grep -c), never by reconstructing state from memory or mass re-reads. - Evidence lives on disk, not in context. Sanitizer reports, run logs and coverage numbers are saved under the per-project report area and referenced by path; context keeps only the decisive lines (verdict, crash type, top frames,
cov:numbers).
Deliverables
The result of a run, all inside the marked working area (see references/worktree_delivery.md):
- The list of surviving worktree branch duo pairs: OSS-Fuzz side
oss-fuzz-<project>-<suffix>, upstream side<project>-<suffix>, with their worktree paths and base commit SHAs recorded. A project may contribute several pairs (fuzzer pairs, a standalone corpus pair, a build-fix pair), grouped per the Phase 4 rules. - A final summary in markdown table form, one row per duo pair: project, language, duo branches, depends-on, worktree paths, summary of work, coverage delta, status.
- Skipped or unprocessable projects listed in the same summary with the concrete reason.
- Rejected duo pairs (still failing after the fix budget) moved into the rejected area, kept intact, and marked clearly in the summary with the failure reason and what was attempted.
The pipeline
Work the phases strictly in order, and conclude each phase in writing (manifest and final report) before starting the next.
Phase 0: Select projects and verify upstream viability
Selection uses the deterministic selector bundled with this skill (scripts/select_projects.sh next to this SKILL.md); output is project<TAB>language, one per line, where the language is the one declared in project.yaml (a missing field is the legacy c++ default), not verified against the source, and the Dockerfile base image is never a language signal. Activate the matching sub-skill per the mapping above. Reread this data on every run, even for projects seen before: a project whose project.yaml changed since an earlier run (for example its language moving from C++ to Rust) is treated according to the fresh values, never the previous run's memory.
scripts/select_projects.sh '*' # all projects (any language)
scripts/select_projects.sh 'lib*' 'json*' # glob subset
scripts/select_projects.sh --language c,c++ '*' # scope by language
scripts/select_projects.sh --broken --limit 20 '*' # broken builds first
scripts/select_projects.sh --exclude 'curl,wget' '*'
Before doing any real work on a selected project, verify the upstream is viable. Never trust main_repo in project.yaml: it may be missing or wrong. Always read the project's Dockerfile to find what is actually cloned or downloaded (a git clone, a downloaded tarball, or svn), and run the checks against that real location:
- repository marked archived: stop and notify, manifest
blocked(upstream-archived); - no commits for 24 months or more: stop and notify,
blocked(upstream-inactive); - repository moved or abandoned (moved redirects, "we moved" banners, homepage pointing elsewhere while the integration still points at the dead location): stop and notify,
blocked(upstream-moved), noting the new location if it is discoverable, but never chase it automatically; - source is not a git repository (tarball or svn): stop and notify,
blocked(upstream-not-git).
Stopping is mandatory in every case; it is never agent judgement. Then create (or resume) the per-project manifest fragment at build/coverage-pipeline/manifest/<project>.md (one authoritative file per project; the batch driver merges a combined manifest.md view after the run; a legacy single-file manifest is history):
| project | language | status | duo branches | worktree paths | base SHAs | report | notes |
|---|
Statuses: selected, viable, builds-green, triaged, improved, validated, delivered, rejected, no-worthy-targets, deferred(budget), or blocked(<reason>). Update the row at the end of every phase and after every completed step (pair staged, fix applied, build or gate result, decision taken), so an eviction mid-phase cannot orphan work; a fresh or post-eviction session resumes by reading the manifest fragment plus bounded verification (git diff --stat, a couple of targeted greps), never by re-reading big files to re-establish ground truth. When a project yields several pairs, give each pair its own manifest row (same project, its own suffix and duo branches), with a tested-with: <project>-build-fix note in the notes column when it depends on the build fix. The language column starts as the declared language; after a mid-run language switch (see Phase 2), record it as declared(X)/actual(Y). A rerun after a previous delivered batch starts fresh rows (or a new dated section) and treats earlier rows as history only; previously rejected pairs may be deliberately retried against the new state. Sessions exit via the exit protocol: before exiting, a session updates the manifest with the pairs delivered, the remaining ranked targets with rationales, and a terminal stop line STOP: <project> : <worth-exhausted|cap-reached|no-worthy-targets|budget-exhausted|blocked(...)>; running out of context means checkpointing progress and deferred entries, never a shallow wrap-up. Declaring no-worthy-targets requires genuine judgement and proof: a per-region worth analysis with the top rejected candidate regions listed, their numbers, and why each fails the worth model; it is never a quick early exit and is reviewed as seriously as a failure.
Multi-project discipline: serialise only real infra/helper.py executions (Docker builds, checks and runs: one project at a time, since image names collide). Analysis (triage, coverage study) and worktree/fuzzer generation may proceed in parallel across projects and pairs. With 1,300+ projects in OSS-Fuzz (~600 C/C++), prefer prioritised subsets over *: broken builds first (fast wins that also unlock coverage data), then the lowest own-code coverage on security-sensitive surface.
Phase 1: Builds, mandatory and optional fixes
Get the builds into a state where analysis is possible, always via infra/helper.py:
python3 infra/helper.py build_fuzzers <project>
python3 infra/helper.py build_fuzzers --sanitizer coverage <project>
python3 infra/helper.py build_fuzzers --sanitizer introspector <project>
python3 infra/helper.py check_build <project>
- Run long builds in the background: redirect output to a log file and poll with one short bounded command (
tail -c 300 <log>); never hold a slot with a multi-minute foregroundsleep, and never re-read a whole build log. On failure, extract only the error region (firsterror:or sanitizer summary plus a few lines) into the report before fixing. - The main fuzzer build fix is always mandatory: minimal, targeted changes only. When the main build is broken, the fix becomes its own
-build-fixduo pair, created and validated before any dependent pair (see Phase 4 and the worktree reference). An upstream-side build fix must itself stay within the allowed upstream categories (fuzzers, fuzz build configuration, theFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTIONmacro); if the build can only be repaired by changing product code, stop and notifyblocked(product-code-fix-needed). - Coverage and introspector build fixes are expected, but are optional when the failure cause is missing corpora or an OOM/timeout. Record the exemption with evidence, then proceed using the most recent successful historical report (Phase 2 date walk-back). These failures do not trigger the build-fix protocol.
- A
check_buildfailure caused by a crash is classified like any other post-build crash (see the worktree reference): it is a harness defect only when the crash is the fuzzer's fault; a crash classified as a real finding still passes this gate with the discovery marked. - The full
helper.py introspectorchain is heavy; reserve it for when an actual Introspector report is needed (seecode_coverage.mdsection 7).