Skip to content

Document cargo-afl fuzzing support - #2815

Merged
ElliotFriend merged 25 commits into
mainfrom
docs-cargo-afl-fuzzing
Sep 8, 2026
Merged

Document cargo-afl fuzzing support#2815
ElliotFriend merged 25 commits into
mainfrom
docs-cargo-afl-fuzzing

Conversation

@leighmcculloch

@leighmcculloch leighmcculloch commented Sep 3, 2026

Copy link
Copy Markdown
Member

What

Add a step-by-step guide for fuzzing Soroban contracts with cargo-afl (AFL++) to the fuzzing guide, replacing the placeholder note that just pointed readers to the generic Rust Fuzz book.

Why

We should demonstrate it as the fuzzing tools can be a bit overwhelming.

@github-actions github-actions Bot added the preview Preview builds for PRs by SDF employees. label Sep 3, 2026
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot removed the preview Preview builds for PRs by SDF employees. label Sep 3, 2026
@github-actions github-actions Bot added the preview Preview builds for PRs by SDF employees. label Sep 3, 2026
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot added preview Preview builds for PRs by SDF employees. and removed preview Preview builds for PRs by SDF employees. labels Sep 3, 2026
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

@leighmcculloch
leighmcculloch marked this pull request as ready for review September 3, 2026 13:18
@leighmcculloch
leighmcculloch requested review from ElliotFriend and a balanced review from Copilot September 3, 2026 13:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a step-by-step guide for fuzzing Soroban contracts with cargo-afl.

Changes:

  • Documents installation, configuration, execution, and crash replay.
  • Adds an AFL++ fuzz-target example and references.
Suppressed comments (5)

docs/build/guides/testing/fuzzing.mdx:148

  • This dependency name does not match the package used by the linked increment example (soroban-increment-contract). Cargo therefore looks for a package named my-contract at .. and fails before compiling the target.
   my-contract = { path = ".." }

docs/build/guides/testing/fuzzing.mdx:169

  • An arbitrary u64 makes most executions effectively unbounded: the provided eight-byte seed decodes to a value in the quadrillions, so the very first execution spends its time in the loop and is classified as a timeout instead of exercising useful inputs. Bound the generated operation count to keep every fuzz iteration fast.
       pub by: u64,

docs/build/guides/testing/fuzzing.mdx:184

  • last is never updated, so Some(current) > None is true on every successful call and the stated monotonicity property is not actually tested. Save each successful value after asserting it.
                   Ok(Ok(current)) => assert!(Some(current) > last),

docs/build/guides/testing/fuzzing.mdx:218

  • After AFL++ records more than one crash, this wildcard expands to multiple paths and the shell rejects the input redirection as ambiguous. Select and quote one concrete crash path before replaying it.
RUST_BACKTRACE=1 ./target/debug/fuzz_target_1 < out/default/crashes/id:000000*

docs/build/guides/testing/fuzzing.mdx:211

  • This rationale is incorrect for cargo-afl: its build wrapper explicitly passes both -C overflow_checks and -C debug-assertions for instrumented Cargo builds, including release builds. Avoid telling readers that release mode necessarily loses these checks.
   Fuzz debug builds, at least at first: they keep integer overflow checks and `debug_assert!`s enabled, and those catch bugs a release build won't.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docs/build/guides/testing/fuzzing.mdx Outdated
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

@kaankacar

Copy link
Copy Markdown
Contributor

🤖 Automated message from Kaan's Automated Triage Bot.

Verified the cargo-afl steps against afl.rs, AFL++, Cargo and soroban-examples. The walkthrough did not work as written, so I pushed the fixes: 16 Copilot points adjudicated, 12 fixed and 4 rejected with reasons in the threads. Copilot's last pass is clean and every check passes. This PR's preview host returns 404, so build / build at the head is the render evidence.
Ready to merge.

@kaankacar kaankacar added the bot:ready-to-merge Bot verified and approved; waiting for a maintainer to merge label Sep 7, 2026
Copilot AI review requested due to automatic review settings September 7, 2026 22:16
@github-actions github-actions Bot removed the preview Preview builds for PRs by SDF employees. label Sep 7, 2026
@leighmcculloch

leighmcculloch commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

@kaankacar I undid some of the changes because they added some information that wasn't critical, and I think they were distracting for a minimal tutorial. It looks like the changes were driven by Copilot feedback.

Thanks for fixing the last bug.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment thread docs/build/guides/testing/fuzzing.mdx Outdated
Comment thread docs/build/guides/testing/fuzzing.mdx
Comment thread docs/build/guides/testing/fuzzing.mdx
Copilot AI review requested due to automatic review settings September 7, 2026 22:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@github-actions github-actions Bot added the preview Preview builds for PRs by SDF employees. label Sep 7, 2026
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

@kaankacar

Copy link
Copy Markdown
Contributor

🤖 Automated message from Kaan's Automated Triage Bot.

Re-checked at 7ee9244. Your trims kept every functional fix: the lib crate-type step, the direct arbitrary dep, the [workspace] table, last = Some(current) and the bounded u8 count. The u9 typo is gone.
Preview renders the two new sections with working anchors and links, and all checks pass. Ready to merge.

@kaankacar

Copy link
Copy Markdown
Contributor

Hello @leighmcculloch , looks like the automated triage bot has picked up your PRs too :) This is a good feedback for the bot's judgement call, I'm fixing the bot in a way where it doesn't interfere with ongoing PRs(as long as a review is not requested). I do apologize on behalf of my bot if it has gotten annoying :)

@kaankacar kaankacar removed the bot:ready-to-merge Bot verified and approved; waiting for a maintainer to merge label Sep 8, 2026

@ElliotFriend ElliotFriend left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@ElliotFriend
ElliotFriend merged commit abac670 into main Sep 8, 2026
10 checks passed
@ElliotFriend
ElliotFriend deleted the docs-cargo-afl-fuzzing branch September 8, 2026 15:18
@github-actions github-actions Bot removed the preview Preview builds for PRs by SDF employees. label Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

PR Preview: torn down

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants