Skip to content

Commit 7d179db

Browse files
Jonathan D.A. Jewellclaude
andcommitted
feat: add ClusterFuzzLite fuzzing configuration
- Add .clusterfuzzlite/ directory with project config - Add fuzz/ directory with initial fuzz target - Add CI workflows for PR and batch fuzzing - Improves OpenSSF Scorecard FuzzingID check Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent ba6af91 commit 7d179db

7 files changed

Lines changed: 85 additions & 0 deletions

File tree

.clusterfuzzlite/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM gcr.io/oss-fuzz-base/base-builder-rust
2+
RUN apt-get update && apt-get install -y make autoconf automake libtool
3+
COPY . $SRC/neurophone
4+
WORKDIR $SRC/neurophone
5+
COPY .clusterfuzzlite/build.sh $SRC/

.clusterfuzzlite/build.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash -eu
2+
cd $SRC/*/fuzz
3+
cargo +nightly fuzz build
4+
for target in fuzz_targets/*; do
5+
target_name=$(basename ${target%.rs})
6+
cp target/x86_64-unknown-linux-gnu/release/$target_name $OUT/
7+
done

.clusterfuzzlite/project.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
homepage: "https://github.com/hyperpolymath/neurophone"
2+
language: rust
3+
main_repo: "https://github.com/hyperpolymath/neurophone"
4+
sanitizers:
5+
- address
6+
- undefined

.github/workflows/cflite_batch.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# SPDX-License-Identifier: PMPL-1.0-or-later
2+
name: ClusterFuzzLite Batch Fuzzing
3+
on:
4+
schedule:
5+
- cron: '0 0 * * 0' # Weekly
6+
permissions: read-all
7+
jobs:
8+
fuzz:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
12+
- uses: google/clusterfuzzlite/actions/build_fuzzers@884713a6c30a92e5e8544c39945cd7cb630abcd1 # v1
13+
with:
14+
language: rust
15+
- uses: google/clusterfuzzlite/actions/run_fuzzers@884713a6c30a92e5e8544c39945cd7cb630abcd1 # v1
16+
with:
17+
github-token: ${{ secrets.GITHUB_TOKEN }}
18+
fuzz-seconds: 1800

.github/workflows/cflite_pr.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# SPDX-License-Identifier: PMPL-1.0-or-later
2+
name: ClusterFuzzLite PR Fuzzing
3+
on:
4+
pull_request:
5+
paths:
6+
- '**/*.rs'
7+
- 'Cargo.toml'
8+
- 'Cargo.lock'
9+
permissions: read-all
10+
jobs:
11+
fuzz:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
15+
- uses: google/clusterfuzzlite/actions/build_fuzzers@884713a6c30a92e5e8544c39945cd7cb630abcd1 # v1
16+
with:
17+
language: rust
18+
- uses: google/clusterfuzzlite/actions/run_fuzzers@884713a6c30a92e5e8544c39945cd7cb630abcd1 # v1
19+
with:
20+
github-token: ${{ secrets.GITHUB_TOKEN }}
21+
fuzz-seconds: 300

fuzz/Cargo.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[package]
2+
name = "neurophone-fuzz"
3+
version = "0.0.0"
4+
publish = false
5+
edition = "2021"
6+
7+
[package.metadata]
8+
cargo-fuzz = true
9+
10+
[dependencies]
11+
libfuzzer-sys = "0.4"
12+
13+
[dependencies.neurophone]
14+
path = ".."
15+
16+
[[bin]]
17+
name = "fuzz_main"
18+
path = "fuzz_targets/fuzz_main.rs"
19+
test = false
20+
doc = false

fuzz/fuzz_targets/fuzz_main.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#![no_main]
2+
use libfuzzer_sys::fuzz_target;
3+
4+
fuzz_target!(|data: &[u8]| {
5+
// TODO: Customize fuzzing logic for this repo
6+
// Example: parse input, test crypto functions, etc.
7+
let _ = std::str::from_utf8(data);
8+
});

0 commit comments

Comments
 (0)