-
Notifications
You must be signed in to change notification settings - Fork 12
chore(fuzz): add cargo-fuzz suite and untrusted-input coverage gate #279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
crowecawcaw
wants to merge
4
commits into
OpenJobDescription:main
Choose a base branch
from
crowecawcaw:add-fuzzing
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b48b338
chore(fuzz): add cargo-fuzz suite and untrusted-input coverage gate
crowecawcaw 3280b7c
docs: mark fuzz-testing report items resolved; document fuzz suite in…
crowecawcaw 96d70e7
fix(fuzz): treat pub(crate)/pub(super) mods as private in coverage gate
crowecawcaw cd3d677
Merge remote-tracking branch 'upstream/main' into add-fuzzing
crowecawcaw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| name: Fuzz | ||
|
|
||
| # Smoke-fuzz every fuzz target on pull requests and on merges to main. The | ||
| # run is short and time-boxed per target so it gates without slowing the merge | ||
| # queue. Any panic, abort, overflow, or char-boundary slice in a fuzzed entry | ||
| # point fails the job. Coverage plateaus within about a minute per target once | ||
| # seeded, so a longer run buys little here; deeper campaigns are left to manual | ||
| # local runs (see fuzz/README.md). | ||
| # | ||
| # The fuzz crate (fuzz/) is deliberately outside the root workspace and builds | ||
| # only with a nightly toolchain under AddressSanitizer, so it lives in its own | ||
| # workflow rather than the stable CI matrix. | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main, release, "patch_*"] | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: fuzz-${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | ||
|
|
||
| env: | ||
| CARGO_INCREMENTAL: 0 | ||
| CARGO_NET_RETRY: 10 | ||
| RUSTUP_MAX_RETRIES: 10 | ||
| RUST_BACKTRACE: 1 | ||
| # Per-target smoke budget, in seconds. Coverage plateaus within a few seconds | ||
| # once seeded, so a short run catches regressions reachable from the corpus; | ||
| # deeper campaigns are run manually (see fuzz/README.md). | ||
| FUZZ_SECONDS: 10 | ||
|
|
||
| jobs: | ||
| fuzz: | ||
| name: Fuzz | ||
| # libFuzzer + cargo-fuzz's sanitizer build is best supported on Linux. | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
|
crowecawcaw marked this conversation as resolved.
|
||
| - uses: actions/checkout@v6 | ||
|
|
||
| # cargo-fuzz requires a nightly toolchain (sanitizer -Z flags). Pin the | ||
| # nightly so a bad nightly (e.g. an ASan codegen ICE) can't randomly break | ||
| # the fuzz job; bump this date deliberately. | ||
| - name: Install Rust nightly | ||
| run: | | ||
| rustup toolchain install nightly-2026-05-15 --profile minimal --component rust-src | ||
| rustup override set nightly-2026-05-15 | ||
|
|
||
| - name: Compute rustc hash | ||
| id: rustc | ||
| run: echo "hash=$(rustc +nightly-2026-05-15 --version --verbose | sha256sum | cut -c1-16)" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Restore cargo + fuzz cache | ||
| uses: actions/cache@v5 | ||
| with: | ||
| path: | | ||
| ~/.cargo/registry/index | ||
| ~/.cargo/registry/cache | ||
| ~/.cargo/git/db | ||
| ~/.cargo/bin/cargo-fuzz | ||
| fuzz/target | ||
| key: fuzz-${{ steps.rustc.outputs.hash }}-${{ hashFiles('**/Cargo.lock', 'fuzz/Cargo.toml') }} | ||
| restore-keys: | | ||
| fuzz-${{ steps.rustc.outputs.hash }}- | ||
| fuzz- | ||
|
|
||
| - name: Install cargo-fuzz | ||
| run: which cargo-fuzz || cargo install cargo-fuzz --locked --version ^0.13 | ||
|
|
||
| # Build + run every target. The target list is derived from | ||
| # `cargo fuzz list` inside the script, so a newly-added target is picked | ||
| # up automatically — nothing to update here. A crash in any target fails | ||
| # the job. | ||
| - name: Run fuzz targets | ||
| run: scripts/run_fuzz.sh | ||
|
|
||
| # If any target produced a crash artifact, surface it so the failure is | ||
| # actionable from the run page instead of just a red X. | ||
| - name: Upload crash artifacts | ||
| if: failure() | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: fuzz-artifacts | ||
| path: fuzz/artifacts | ||
| if-no-files-found: ignore | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| target | ||
| corpus | ||
| artifacts | ||
| coverage | ||
|
|
||
| # libFuzzer writes discovered inputs as 40-hex-char SHA1-named files. When you | ||
| # run a target with `fuzz/seeds/<t>` as the corpus dir, it drops those into the | ||
| # seed dir. They are not curated seeds and must not be committed — ignore them | ||
| # so an accidental `git add` can't sweep them in. Curated seeds use readable | ||
| # names (expr_0, mb_1, tpl_2, …), which this pattern never matches. | ||
| seeds/*/[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.