Skip to content

Add fuzzing infrastructure for ASP.NET Core#67022

Open
BrennanConroy wants to merge 3 commits into
mainfrom
brecon/fuzz
Open

Add fuzzing infrastructure for ASP.NET Core#67022
BrennanConroy wants to merge 3 commits into
mainfrom
brecon/fuzz

Conversation

@BrennanConroy
Copy link
Copy Markdown
Member

Heavily inspired by https://github.com/dotnet/runtime/tree/main/src/libraries/Fuzzing

Adds fuzzing infrastructure
Adds a MultipartReader fuzzer as an example
Fixes a bug in MultipartReader found as part of fuzzing

@BrennanConroy BrennanConroy requested review from a team, halter73 and wtgodbe as code owners June 4, 2026 19:09
@BrennanConroy BrennanConroy added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Jun 4, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Hey @dotnet/aspnet-build, looks like this PR is something you want to take a look at.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a new fuzzing area under src/Fuzzing (modeled after dotnet/runtime’s fuzzing infrastructure) to support running libFuzzer-based fuzzers against ASP.NET Core assemblies (instrumented via SharpFuzz), adds an example MultipartReader fuzzer, and hardens MultipartReader by rejecting invalid boundary lines (with accompanying regression tests).

Changes:

  • Added a new src/Fuzzing/AspNetCoreFuzzing project and tooling (deployment prep, coverage script, docs, gitignore) for local fuzzing + OneFuzz deployment.
  • Added OneFuzz deployment pipeline and build infrastructure hooks (new IsFuzzingProject, SharpFuzz dependency/version wiring, third-party notices).
  • Fixed MultipartReaderStream to throw on unexpected trailing data on boundary lines and added regression tests for sync/async paths.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 23 comments.

Show a summary per file
File Description
THIRD-PARTY-NOTICES.txt Adds SharpFuzz license notice.
src/Http/WebUtilities/test/MultipartReaderTests.cs Adds regression tests for boundary lines with trailing data/whitespace.
src/Http/WebUtilities/src/MultipartReaderStream.cs Changes boundary parsing to throw on invalid trailing data.
src/Fuzzing/README.md Adds documentation for local fuzzing, debugging, coverage, and CI deployment workflow.
src/Fuzzing/AspNetCoreFuzzing/run.bat Helper to locate the built fuzzer harness and run prepare-onefuzz.
src/Fuzzing/AspNetCoreFuzzing/Program.cs Fuzzing harness entrypoint + OneFuzz deployment generation + instrumentation logic.
src/Fuzzing/AspNetCoreFuzzing/IFuzzer.cs Defines the fuzzer target interface and discovery model.
src/Fuzzing/AspNetCoreFuzzing/Fuzzers/MultipartReaderFuzzer.cs Adds the example MultipartReader fuzzer target.
src/Fuzzing/AspNetCoreFuzzing/collect-coverage.ps1 Adds a script to collect coverage from fuzz corpora.
src/Fuzzing/AspNetCoreFuzzing/Assert.cs Lightweight assertion helpers for fuzzing targets.
src/Fuzzing/AspNetCoreFuzzing/AspNetCoreFuzzing.csproj New fuzzing harness project definition (self-contained exe).
src/Fuzzing/.gitignore Ignores generated deployment/corpus/crash/coverage artifacts.
eng/Versions.props Adds SharpFuzzVersion.
eng/targets/ResolveReferences.targets Excludes fuzzing projects from shared-framework project-reference adjustments.
eng/Dependencies.props Adds SharpFuzz to “latest package reference” set.
Directory.Build.props Introduces IsFuzzingProject and marks fuzzing projects as non-shipping.
.azure/pipelines/fuzzing/deploy-to-onefuzz.yml Adds scheduled pipeline to build and deploy fuzzers to OneFuzz.

Comment thread src/Http/WebUtilities/src/MultipartReaderStream.cs
Comment thread src/Http/WebUtilities/src/MultipartReaderStream.cs
Comment thread src/Fuzzing/AspNetCoreFuzzing/Fuzzers/MultipartReaderFuzzer.cs
Comment thread src/Fuzzing/AspNetCoreFuzzing/Program.cs Outdated
Comment thread src/Fuzzing/AspNetCoreFuzzing/Program.cs
Comment thread src/Fuzzing/AspNetCoreFuzzing/collect-coverage.ps1 Outdated
Comment thread src/Fuzzing/AspNetCoreFuzzing/collect-coverage.ps1
Comment thread src/Fuzzing/AspNetCoreFuzzing/collect-coverage.ps1
Comment thread src/Fuzzing/AspNetCoreFuzzing/collect-coverage.ps1
Comment thread src/Fuzzing/AspNetCoreFuzzing/collect-coverage.ps1
Copy link
Copy Markdown
Member

@DeagleGross DeagleGross left a comment

Choose a reason for hiding this comment

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

Cool project!

"ConfigVersion": 3,
"Entries": [
{
"JobNotificationEmail": "brecon@microsoft.com",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

use team alias? or you want to test it yourself only for now?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If you do use a team, everyone should configure email rules since you'll get a lot of spam (2 emails per fuzzer per day).
I'm using dotnet-fuzz-updates@microsoft.com for this rn

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Going to keep it as-is for now while we get it setup. Will revisit later.

Comment thread src/Fuzzing/AspNetCoreFuzzing/Program.cs Outdated
Comment thread src/Fuzzing/AspNetCoreFuzzing/Program.cs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants