Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ClusterFuzzLite in CI featuring PR fuzzing, batch fuzzing and fuzz coverage reports #820

Merged
merged 25 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
bbac227
Add initial clusterfuzzlite setup
maxammann Apr 30, 2024
ee9263f
Disable broken fuzzer
maxammann Apr 30, 2024
39bdc54
Enable batch and cron
maxammann Apr 30, 2024
cec0cbb
Change fuzz duration
maxammann Apr 30, 2024
d2f7e6e
Reduce again
maxammann Apr 30, 2024
ea08323
Fix coverage
maxammann Apr 30, 2024
a0bc63f
Trigger CI
maxammann Apr 30, 2024
2e9d5d4
Update fuzz times
maxammann Apr 30, 2024
a39385f
Add documentation and fix corpus repo
maxammann May 2, 2024
138b0da
chore: Changelog entry
netrome Sep 11, 2024
bc18a85
feat: use github app for token
mchristopher Sep 23, 2024
773bbb1
fix: run on all PRs
mchristopher Sep 23, 2024
9a5becf
fix: allow workflows to be manually run
mchristopher Sep 24, 2024
778000f
fix: test other token format
mchristopher Sep 24, 2024
f9b4fb6
fix: add username and token to url
mchristopher Sep 24, 2024
179a927
feat: temp debug
mchristopher Sep 24, 2024
0d85789
feat: more debug logging
mchristopher Sep 24, 2024
4f8c50d
feat: working app token
mchristopher Sep 24, 2024
0623963
feat: use latest nightly in CI
netrome Sep 25, 2024
6443e81
feat: pin nightly compiler version
netrome Sep 25, 2024
456fb44
chore: Remove flag needed for older compiler
netrome Sep 27, 2024
2d846dd
fix: Remove confusing comments
netrome Sep 27, 2024
775bce9
Merge branch 'master' into chore/tob-fuzzer-clusterfuzzlite
xgreenx Oct 1, 2024
4d45ae9
Merge branch 'master' into chore/tob-fuzzer-clusterfuzzlite
xgreenx Oct 1, 2024
23eee26
Merge branch 'master' into chore/tob-fuzzer-clusterfuzzlite
xgreenx Oct 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .clusterfuzzlite/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM gcr.io/oss-fuzz-base/base-builder-rust:v1
RUN rustup install nightly-2024-09-24 && rustup default nightly-2024-09-24
RUN rustup component add rust-src --toolchain nightly-2024-09-24
ENV RUSTUP_TOOLCHAIN=nightly-2024-09-24
COPY . $SRC/fuel-vm
WORKDIR fuel-vm
COPY .clusterfuzzlite/build.sh $SRC/
5 changes: 5 additions & 0 deletions .clusterfuzzlite/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ClusterFuzzLite

This directory contains the configuration for [ClusterFuzzLite](https://google.github.io/clusterfuzzlite/). CFL is used in the GitHub Actions CI in several workflows.

The corpus and more documentation can be found in [FuelLabs/fuel-fuzzing-corpus](https://github.com/FuelLabs/fuel-fuzzing-corpus).
9 changes: 9 additions & 0 deletions .clusterfuzzlite/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash -eu

cd $SRC/fuel-vm

cd fuel-vm

cargo fuzz build -O --sanitizer none

cp fuzz/target/x86_64-unknown-linux-gnu/release/grammar_aware_advanced $OUT/
1 change: 1 addition & 0 deletions .clusterfuzzlite/project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
language: rust
33 changes: 33 additions & 0 deletions .github/workflows/cflite_batch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: ClusterFuzzLite batch fuzzing
on:
workflow_dispatch:
schedule:
- cron: '0 0/24 * * *' # Every 24th hour
permissions: read-all
jobs:
BatchFuzzing:
runs-on: ubuntu-latest
steps:
- name: Get fuzzer auth token
uses: actions/create-github-app-token@v1
id: fuzzer-token
with:
owner: ${{ github.repository_owner }}
app-id: ${{ vars.FUEL_FUZZING_CORPUS_APP_ID }}
private-key: ${{ secrets.FUEL_FUZZING_CORPUS_APP_KEY }}
- name: Build Fuzzers (${{ matrix.sanitizer }})
id: build
uses: google/clusterfuzzlite/actions/build_fuzzers@v1
with:
language: rust
- name: Run Fuzzers (${{ matrix.sanitizer }})
id: run
uses: google/clusterfuzzlite/actions/run_fuzzers@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
fuzz-seconds: 3600
mode: 'batch'
output-sarif: true
storage-repo: https://oauth2:${{ steps.fuzzer-token.outputs.token }}@github.com/FuelLabs/fuel-fuzzing-corpus.git
storage-repo-branch: main
storage-repo-branch-coverage: gh-pages
60 changes: 60 additions & 0 deletions .github/workflows/cflite_cron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: ClusterFuzzLite cron tasks
on:
workflow_dispatch:
schedule:
- cron: '0 0/72 * * *'
permissions: read-all
jobs:
Pruning:
runs-on: ubuntu-latest
steps:
- name: Get fuzzer auth token
uses: actions/create-github-app-token@v1
id: fuzzer-token
with:
owner: ${{ github.repository_owner }}
app-id: ${{ vars.FUEL_FUZZING_CORPUS_APP_ID }}
private-key: ${{ secrets.FUEL_FUZZING_CORPUS_APP_KEY }}
- name: Build Fuzzers
id: build
uses: google/clusterfuzzlite/actions/build_fuzzers@v1
with:
language: rust
- name: Run Fuzzers
id: run
uses: google/clusterfuzzlite/actions/run_fuzzers@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
fuzz-seconds: 600
mode: 'prune'
output-sarif: true
storage-repo: https://oauth2:${{ steps.fuzzer-token.outputs.token }}@github.com/FuelLabs/fuel-fuzzing-corpus.git
storage-repo-branch: main
storage-repo-branch-coverage: gh-pages
Coverage:
runs-on: ubuntu-latest
steps:
- name: Get fuzzer auth token
uses: actions/create-github-app-token@v1
id: fuzzer-token
with:
owner: ${{ github.repository_owner }}
app-id: ${{ vars.FUEL_FUZZING_CORPUS_APP_ID }}
private-key: ${{ secrets.FUEL_FUZZING_CORPUS_APP_KEY }}
- name: Build Fuzzers
id: build
uses: google/clusterfuzzlite/actions/build_fuzzers@v1
with:
language: rust
sanitizer: coverage
- name: Run Fuzzers
id: run
uses: google/clusterfuzzlite/actions/run_fuzzers@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
fuzz-seconds: 600
mode: 'coverage'
sanitizer: 'coverage'
storage-repo: https://oauth2:${{ steps.fuzzer-token.outputs.token }}@github.com/FuelLabs/fuel-fuzzing-corpus.git
storage-repo-branch: main
storage-repo-branch-coverage: gh-pages
38 changes: 38 additions & 0 deletions .github/workflows/cflite_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: ClusterFuzzLite PR fuzzing

on:
pull_request:
workflow_dispatch:

permissions: read-all
jobs:
PR:
runs-on: ubuntu-latest
steps:
- name: Get fuzzer auth token
uses: actions/create-github-app-token@v1
id: fuzzer-token
with:
owner: ${{ github.repository_owner }}
app-id: ${{ vars.FUEL_FUZZING_CORPUS_APP_ID }}
private-key: ${{ secrets.FUEL_FUZZING_CORPUS_APP_KEY }}
- name: Build Fuzzers
id: build
uses: google/clusterfuzzlite/actions/build_fuzzers@v1
with:
language: rust
github-token: ${{ secrets.GITHUB_TOKEN }}
storage-repo: https://oauth2:${{ steps.fuzzer-token.outputs.token }}@github.com/FuelLabs/fuel-fuzzing-corpus.git
storage-repo-branch: main
storage-repo-branch-coverage: gh-pages
- name: Run Fuzzers
id: run
uses: google/clusterfuzzlite/actions/run_fuzzers@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
fuzz-seconds: 600
mode: 'code-change'
output-sarif: true
storage-repo: https://oauth2:${{ steps.fuzzer-token.outputs.token }}@github.com/FuelLabs/fuel-fuzzing-corpus.git
storage-repo-branch: main
storage-repo-branch-coverage: gh-pages
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Added
- [#838](https://github.com/FuelLabs/fuel-vm/pull/838): Implemented `AsRef<[u8]>` and `TryFrom<&[u8]>` for DA compression types: ScriptCode, PredicateCode, RegistryKey.
- [#820](https://github.com/FuelLabs/fuel-vm/pull/820): Add fuzzing in CI with ClusterFuzzLite.

### Removed

Expand Down
Loading