-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Json fuzzer #3852
base: master
Are you sure you want to change the base?
Json fuzzer #3852
Conversation
There was a problem hiding this 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 Neo.Json.Fuzzer – a new fuzzing tool aimed at testing the Neo.Json library for bugs, vulnerabilities, and performance issues by generating and mutating JSON inputs. Key changes include:
- Implementation of various mutation components (MutationEngine, ConcurrentAccessMutations, CharacterMutations, BooleanMutations, BaseMutationEngine) to diversify JSON mutations.
- Extensive new documentation covering generation strategies, testing approaches (JPath, Unicode, numeric precision, streaming, concurrent access, DOS detection, coverage analysis), and extension guidelines.
Reviewed Changes
Copilot reviewed 86 out of 86 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
fuzzers/Neo.Json.Fuzzer/Generators/MutationEngine.cs | Core mutation engine coordinating diverse mutation strategies and handling valid/invalid JSON inputs. |
fuzzers/Neo.Json.Fuzzer/Generators/ConcurrentAccessMutations.cs | Implements concurrent access mutation strategies to simulate shared data tests under multithreading. |
fuzzers/Neo.Json.Fuzzer/Generators/CharacterMutations.cs | Provides character-level mutations and includes a helper to select JSON-relevant characters. |
fuzzers/Neo.Json.Fuzzer/Generators/BooleanMutations.cs | Contains strategies to modify boolean values and convert non-boolean values, ensuring diverse boolean mutations. |
fuzzers/Neo.Json.Fuzzer/Generators/BaseMutationEngine.cs | Base class that establishes common limits and utility functions for mutation operations. |
Documentation (various .md files) | New and updated documentation outlining comprehensive testing strategies for JSON generation, mutation, DOS detection, coverage analysis, JPath testing, concurrent access, and extension guidelines. |
/// </summary> | ||
private char GetRandomJsonCharacter() | ||
{ | ||
string jsonChars = "{}[]\":,0123456789.truefalsnl "; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The string of JSON characters appears to contain a typo ('truefalsnl'). Consider verifying and correcting this to the intended set of characters (e.g. 'truefalse null' or a specific list of valid JSON punctuation).
string jsonChars = "{}[]\":,0123456789.truefalsnl "; | |
string jsonChars = "{}[]\":,0123456789truefalsenull "; |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
catch | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The catch block in SelectAndApplyMutation swallows all exceptions silently. Consider logging the exception details or handling it in a way that aids debugging while still falling back to character-level mutation.
catch | |
{ | |
catch (Exception ex) | |
{ | |
// Log the exception details | |
Debug.WriteLine($"Exception in SelectAndApplyMutation: {ex}"); |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
Neo.Json.FuzzerA specialized fuzzing tool for testing the Neo.Json library's robustness, security, and performance. OverviewNeo.Json.Fuzzer systematically tests the Neo.Json library by generating diverse JSON inputs, including edge cases and malformed structures, to identify potential vulnerabilities, crashes, and denial-of-service vectors. This fuzzer focuses specifically on testing the built-in limits and constraints of the Neo.Json library, such as maximum nesting depth, string length handling, numeric precision, and resource utilization during parsing. Key Features
DocumentationThe project follows a documentation-first approach, with comprehensive documentation for all components: Core Components
Testing Strategies
Analysis and Results
Extension Guide
Getting StartedPrerequisites
Buildingdotnet build Runningdotnet run -- [options] Common options:
Specialized testing options:
See Project Structure
Testing ResultsInitial testing has identified several areas for improvement in Neo.Json:
ContributingContributions are welcome! Please see EXTENDING.md for guidelines on extending the fuzzer with new capabilities. |
Description
This PR introduces Neo.Json.Fuzzer, a specialized fuzzing tool designed to test the Neo.Json library for bugs, vulnerabilities, and performance issues. The fuzzer generates diverse JSON inputs, applies mutations, and analyzes the behavior of Neo.Json when processing these inputs.
Fixes #
Type of change
Test Configuration:
Checklist: