From d407eb61f02f622016f6d340255de352d5d2159a Mon Sep 17 00:00:00 2001 From: Alex Gorevski Date: Thu, 19 Feb 2026 13:19:56 -0800 Subject: [PATCH] test(fuzz): add webhook, provider response, and command validation fuzz targets Add three new fuzz targets expanding coverage from 2 to 5 targets: - fuzz_webhook_payload: fuzzes webhook body JSON deserialization - fuzz_provider_response: fuzzes provider API response parsing - fuzz_command_validation: fuzzes security policy command validation Addresses audit findings for critical fuzz coverage gaps in gateway, provider, and security subsystems. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- fuzz/Cargo.toml | 18 ++++++++++++++++++ fuzz/fuzz_targets/fuzz_command_validation.rs | 10 ++++++++++ fuzz/fuzz_targets/fuzz_provider_response.rs | 9 +++++++++ fuzz/fuzz_targets/fuzz_webhook_payload.rs | 9 +++++++++ 4 files changed, 46 insertions(+) create mode 100644 fuzz/fuzz_targets/fuzz_command_validation.rs create mode 100644 fuzz/fuzz_targets/fuzz_provider_response.rs create mode 100644 fuzz/fuzz_targets/fuzz_webhook_payload.rs diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index b9d2bbe..e55d4da 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -24,3 +24,21 @@ name = "fuzz_tool_params" path = "fuzz_targets/fuzz_tool_params.rs" test = false doc = false + +[[bin]] +name = "fuzz_webhook_payload" +path = "fuzz_targets/fuzz_webhook_payload.rs" +test = false +doc = false + +[[bin]] +name = "fuzz_provider_response" +path = "fuzz_targets/fuzz_provider_response.rs" +test = false +doc = false + +[[bin]] +name = "fuzz_command_validation" +path = "fuzz_targets/fuzz_command_validation.rs" +test = false +doc = false diff --git a/fuzz/fuzz_targets/fuzz_command_validation.rs b/fuzz/fuzz_targets/fuzz_command_validation.rs new file mode 100644 index 0000000..13cce01 --- /dev/null +++ b/fuzz/fuzz_targets/fuzz_command_validation.rs @@ -0,0 +1,10 @@ +#![no_main] +use libfuzzer_sys::fuzz_target; +use zeroclaw::security::SecurityPolicy; + +fuzz_target!(|data: &[u8]| { + if let Ok(s) = std::str::from_utf8(data) { + let policy = SecurityPolicy::default(); + let _ = policy.validate_command_execution(s, false); + } +}); diff --git a/fuzz/fuzz_targets/fuzz_provider_response.rs b/fuzz/fuzz_targets/fuzz_provider_response.rs new file mode 100644 index 0000000..73f895d --- /dev/null +++ b/fuzz/fuzz_targets/fuzz_provider_response.rs @@ -0,0 +1,9 @@ +#![no_main] +use libfuzzer_sys::fuzz_target; + +fuzz_target!(|data: &[u8]| { + if let Ok(s) = std::str::from_utf8(data) { + // Fuzz provider API response deserialization + let _ = serde_json::from_str::(s); + } +}); diff --git a/fuzz/fuzz_targets/fuzz_webhook_payload.rs b/fuzz/fuzz_targets/fuzz_webhook_payload.rs new file mode 100644 index 0000000..1f5b813 --- /dev/null +++ b/fuzz/fuzz_targets/fuzz_webhook_payload.rs @@ -0,0 +1,9 @@ +#![no_main] +use libfuzzer_sys::fuzz_target; + +fuzz_target!(|data: &[u8]| { + if let Ok(s) = std::str::from_utf8(data) { + // Fuzz webhook body deserialization + let _ = serde_json::from_str::(s); + } +});