Extend fuzzing for ctap1 and ctap2 requests

Previously, we only fuzzed the deserialization of
PublicKeyCredentialUserEntity.  This patch replaces that fuzz target
with the deserialization of entire ctap1 and ctap2 requests.
This commit is contained in:
Robin Krahl
2024-06-27 11:07:35 +02:00
parent 4c6a2cb509
commit d8bf6ea0f8
5 changed files with 48 additions and 16 deletions
+14
View File
@@ -38,6 +38,20 @@ jobs:
cargo check --features get-info-full
cargo check --features large-blobs
check-fuzz:
name: Check fuzz targets
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- name: Check fuzz targets
run: |
cargo check --manifest-path fuzz/Cargo.toml
test:
name: Run tests
runs-on: ubuntu-latest
+15 -6
View File
@@ -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 = ".."
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -1,10 +0,0 @@
#![no_main]
use libfuzzer_sys::fuzz_target;
use ctap_types::serde::cbor_deserialize;
fuzz_target!(|data: &[u8]| {
// fuzzed code goes here
type T = ctap_types::webauthn::PublicKeyCredentialUserEntity;
cbor_deserialize::<T>(&data).ok();
});