elara-fuzz
Fuzzing infrastructure for the ELARA Protocol.
Overview
This crate provides a trait-based framework for creating fuzz targets that can discover edge cases, panics, and security vulnerabilities in parsing and cryptographic code.
The fuzzing infrastructure is designed to integrate seamlessly with cargo-fuzz and libfuzzer for production-grade fuzzing campaigns.
Features
- FuzzTarget trait: Define custom fuzz targets with arbitrary input types
- FuzzResult enum: Classify fuzz outcomes (Ok, Bug, Invalid)
- cargo-fuzz integration: Compatible with libfuzzer-sys for production fuzzing
- Pre-built fuzzers: Ready-to-use fuzzers for wire protocol, crypto, and state reconciliation
Architecture
The fuzzing framework consists of three main components:
- Core Trait (
FuzzTarget): Defines the interface for all fuzz targets - Result Classification (
FuzzResult): Categorizes fuzzing outcomes - Concrete Implementations: Specific fuzzers for ELARA components
Usage
Implementing a Custom Fuzzer
Implement the FuzzTarget trait for your fuzzer:
use ;
use Arbitrary;
Integration with cargo-fuzz
Create fuzz targets in the fuzz/fuzz_targets/ directory:
use fuzz_target;
use ;
fuzz_target!;
Running Fuzz Tests
# Install cargo-fuzz
# List available fuzz targets
# Run a specific fuzz target
# Run with specific options
Pre-built Fuzzers
The crate includes fuzz targets for:
- Wire Protocol Fuzzer (
wire_protocol): Tests frame parsing with arbitrary bytes - Crypto Operations Fuzzer (
crypto_operations): Tests encryption/decryption roundtrips - State Reconciliation Fuzzer (
state_reconciliation): Tests state merge operations
CI Integration
Fuzzing is integrated into the CI pipeline with nightly 8-hour fuzzing runs. See .github/workflows/fuzz.yml for configuration.
Corpus Management
Fuzz corpora are stored in fuzz/corpus/<target_name>/. Interesting test cases discovered during fuzzing are automatically added to the corpus for regression testing.
Crash Reporting
When a crash is discovered:
- The crashing input is saved to
fuzz/artifacts/<target_name>/ - A detailed crash report is generated
- The fuzzing run is marked as failed
- Developers are notified to investigate and fix
Performance
The fuzzing infrastructure is designed for high throughput:
- Target: 10,000+ executions per second per core
- Parallel execution across multiple cores
- Efficient corpus minimization
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.