Skip to content

Commit

Permalink
Extend fuzzing for ctap1 and ctap2 requests
Browse files Browse the repository at this point in the history
Previously, we only fuzzed the deserialization of
PublicKeyCredentialUserEntity.  This patch replaces that fuzz target
with the deserialization of entire ctap1 and ctap2 requests.
  • Loading branch information
robin-nitrokey committed Jun 26, 2024
1 parent 8a48754 commit 6325217
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 16 deletions.
21 changes: 15 additions & 6 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@

[package]
name = "ctap-types-fuzz"
version = "0.0.0"
authors = ["Automatically generated"]
publish = false
edition = "2018"
edition = "2021"

[package.metadata]
cargo-fuzz = true

[dependencies]
libfuzzer-sys = "0.3"
iso7816 = "0.1.2"
libfuzzer-sys = "0.4"

[dependencies.ctap-types]
path = ".."
Expand All @@ -20,5 +19,15 @@ path = ".."
members = ["."]

[[bin]]
name = "example"
path = "fuzz_targets/example.rs"
name = "ctap1"
path = "fuzz_targets/ctap1.rs"
test = false
doc = false
bench = false

[[bin]]
name = "ctap2"
path = "fuzz_targets/ctap2.rs"
test = false
doc = false
bench = false
11 changes: 11 additions & 0 deletions fuzz/fuzz_targets/ctap1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#![no_main]

use ctap_types::ctap1::Request;
use iso7816::command::Command;
use libfuzzer_sys::fuzz_target;

fuzz_target!(|data: &[u8]| {
if let Ok(command) = Command::<7609>::try_from(data) {
Request::try_from(&command).ok();
}
});
8 changes: 8 additions & 0 deletions fuzz/fuzz_targets/ctap2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#![no_main]

use ctap_types::ctap2::Request;
use libfuzzer_sys::fuzz_target;

fuzz_target!(|data: &[u8]| {
Request::deserialize(data).ok();
});
10 changes: 0 additions & 10 deletions fuzz/fuzz_targets/example.rs

This file was deleted.

0 comments on commit 6325217

Please sign in to comment.