pdftract/fuzz/fuzz_targets/profile_yaml.rs
jedarden bc9e6f8e57 test(bf-1b7od): add profile_yaml fuzz target and verify cargo-fuzz configuration
- Create fuzz/fuzz_targets/profile_yaml.rs to test YAML parsing
- Register profile_yaml target in fuzz/Cargo.toml
- Verify cargo-fuzz 0.13.1 is installed and working
- All 7 fuzz targets now operational per plan requirement (line 3236)

Closes bf-1b7od. Verification: notes/bf-1b7od.md
2026-07-06 09:38:59 -04:00

23 lines
774 B
Rust

//! Fuzz target for profile YAML parser.
//!
//! This target tests INV-8 (no panic at public boundary) for the profile YAML loader.
//! Any panic indicates a YAML parser bug that must be fixed.
//!
//! The target exercises:
//! - YAML parsing via serde_yaml
//! - Profile structure validation
//! - Secret key detection (forbidden keys like 'password', 'api_key', etc.)
#![no_main]
use libfuzzer_sys::fuzz_target;
fuzz_target!(|data: &[u8]| {
// Convert bytes to string for YAML parsing
let yaml_content = match std::str::from_utf8(data) {
Ok(s) => s,
Err(_) => return, // Skip invalid UTF-8
};
// Test that the YAML parser doesn't panic on malformed input
let _ = pdftract_core::profiles::loader::load_profile_yaml(yaml_content);
});