Add fuzzing infrastructure for ASP.NET Core#67022
Conversation
|
Hey @dotnet/aspnet-build, looks like this PR is something you want to take a look at. |
There was a problem hiding this comment.
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/AspNetCoreFuzzingproject 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
MultipartReaderStreamto 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. |
| "ConfigVersion": 3, | ||
| "Entries": [ | ||
| { | ||
| "JobNotificationEmail": "brecon@microsoft.com", |
There was a problem hiding this comment.
use team alias? or you want to test it yourself only for now?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Going to keep it as-is for now while we get it setup. Will revisit later.
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