mirror of
https://github.com/trussed-dev/ctap-types.git
synced 2026-06-20 04:16:17 -07:00
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:
@@ -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
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
#![no_main]
|
||||
|
||||
use ctap_types::ctap2::Request;
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
Request::deserialize(data).ok();
|
||||
});
|
||||
@@ -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();
|
||||
});
|
||||
Reference in New Issue
Block a user