mirror of
https://github.com/outbackdingo/optimclaw.git
synced 2026-08-31 08:39:24 +00:00
Full rename of all identifiers, filenames, and references: ironclaw → optimclaw IronClaw → OptimClaw IRONCLAW → OPTIMCLAW ironclaw_common → optimclaw_common ironclaw_safety → optimclaw_safety Upstream: nearai/ironclaw
23 lines
843 B
Rust
23 lines
843 B
Rust
#![no_main]
|
|
use optimclaw::safety::Validator;
|
|
use optimclaw::tools::validate_tool_schema;
|
|
use libfuzzer_sys::fuzz_target;
|
|
|
|
fuzz_target!(|data: &[u8]| {
|
|
if let Ok(s) = std::str::from_utf8(data) {
|
|
// Try parsing as JSON and validating as tool parameters
|
|
if let Ok(value) = serde_json::from_str::<serde_json::Value>(s) {
|
|
// Exercise Validator::validate_tool_params with arbitrary JSON
|
|
let validator = Validator::new();
|
|
let result = validator.validate_tool_params(&value);
|
|
// Invariant: result should always be well-formed
|
|
if !result.is_valid {
|
|
assert!(!result.errors.is_empty());
|
|
}
|
|
|
|
// Exercise validate_tool_schema with arbitrary JSON as a schema
|
|
let _ = validate_tool_schema(&value, "fuzz");
|
|
}
|
|
}
|
|
});
|