Skip to content

Commit

Permalink
✨ Introduce AFL support
Browse files Browse the repository at this point in the history
  • Loading branch information
lukacan committed Oct 5, 2024
1 parent 745d869 commit 69cf63b
Show file tree
Hide file tree
Showing 32 changed files with 2,752 additions and 1,645 deletions.
9 changes: 9 additions & 0 deletions .github/actions/setup-afl/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: "Setup AFL"

runs:
using: "composite"
steps:
# Install AFL using Cargo
- name: Install AFL
run: cargo install cargo-afl --version ${{ env.AFL_VERSION }} # Install the specified version of AFL via Cargo
shell: bash
65 changes: 60 additions & 5 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:

env:
HONGGFUZZ_VERSION: 0.5.56 # Honggfuzz version to install in the environment
AFL_VERSION: 0.15.10 # AFL version to install in the environment


jobs:
Fuzz-Tests:
Expand Down Expand Up @@ -39,6 +41,10 @@ jobs:
# Sets up the Trident
uses: ./.github/actions/setup-trident/

- name: Setup AFL
# Sets up AFL, a fuzzing tool that will be used by Trident
uses: ./.github/actions/setup-afl/

- name: Setup Honggfuzz
# Sets up Honggfuzz, a fuzzing tool that will be used by Trident
uses: ./.github/actions/setup-honggfuzz/
Expand All @@ -47,13 +53,13 @@ jobs:
- name: Cache Target Folder
uses: actions/cache@v3
with:
path: examples/fuzz-tests/simple-cpi-6/trident-tests/fuzz_tests/fuzzing/hfuzz_target # Cache the folder where build artifacts are stored
path: examples/fuzz-tests/simple-cpi-6/trident-tests/fuzz_tests/fuzzing/honggfuzz/hfuzz_target # Cache the folder where build artifacts are stored
key: target-${{ runner.os }}-simple-cpi-6 # Unique key for caching based on OS and test

# Run the fuzzing test using Trident in the simple-cpi-6 directory
- name: Test Fuzz
working-directory: examples/fuzz-tests/simple-cpi-6 # Set the working directory for the fuzzing test
run: trident fuzz run fuzz_0 # Run the fuzz test with trident
run: trident fuzz run-hfuzz fuzz_0 # Run the fuzz test with trident

arbitrary-limit-inputs-5:
name: Fuzz Tests (arbitrary-limit-inputs-5)
Expand All @@ -80,6 +86,10 @@ jobs:
# Sets up the Trident
uses: ./.github/actions/setup-trident/

- name: Setup AFL
# Sets up AFL, a fuzzing tool that will be used by Trident
uses: ./.github/actions/setup-afl/

- name: Setup Honggfuzz
# Sets up Honggfuzz, a fuzzing tool that will be used by Trident
uses: ./.github/actions/setup-honggfuzz/
Expand All @@ -88,18 +98,63 @@ jobs:
- name: Cache Target Folder
uses: actions/cache@v3
with:
path: examples/fuzz-tests/arbitrary-limit-inputs-5/trident-tests/fuzz_tests/fuzzing/hfuzz_target # Cache the folder where build artifacts are stored
path: examples/fuzz-tests/arbitrary-limit-inputs-5/trident-tests/fuzz_tests/fuzzing/honggfuzz/hfuzz_target # Cache the folder where build artifacts are stored
key: target-${{ runner.os }}-arbitrary-limit-inputs-5 # Unique key for caching based on OS and test

# Run the fuzzing test using Trident in the arbitrary-limit-inputs-5 directory
- name: Test Fuzz
working-directory: examples/fuzz-tests/arbitrary-limit-inputs-5 # Set the working directory for the fuzzing test
run: trident fuzz run fuzz_0 # Run the fuzz test with trident
run: trident fuzz run-hfuzz fuzz_0 # Run the fuzz test with trident

unauthorized-access-2:
name: Fuzz Tests (unauthorized-access-2)
needs: Fuzz-Tests
# Runs on an Ubuntu 20.04 runner for a different fuzz test
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
name: Checkout Repository # Checkout the repository

# https://github.com/Swatinem/rust-cache
- name: Cache Rust and its Packages
# Caches Rust dependencies to avoid redundant downloads and speed up builds
uses: Swatinem/rust-cache@v2
with:
prefix-key: "fuzz" # Using a locally shared cache key
shared-key: "trident-rust-cache" # Using a shared cache key for multiple jobs

- name: Setup Rust Environment
# Sets up the Rust environment (e.g., installing Rust and required components)
uses: ./.github/actions/setup-rust/

- name: Install Trident
# Sets up the Trident
uses: ./.github/actions/setup-trident/

- name: Setup AFL
# Sets up AFL, a fuzzing tool that will be used by Trident
uses: ./.github/actions/setup-afl/

- name: Setup Honggfuzz
# Sets up Honggfuzz, a fuzzing tool that will be used by Trident
uses: ./.github/actions/setup-honggfuzz/

# Cache the target folder, which stores the build artifacts generated by the fuzzing process
- name: Cache Target Folder
uses: actions/cache@v3
with:
path: examples/fuzz-tests/unauthorized-access-2/trident-tests/fuzz_tests/fuzzing/afl/afl_target # Cache the folder where build artifacts are stored
key: target-${{ runner.os }}-unauthorized-access-2 # Unique key for caching based on OS and test

# Run the fuzzing test using Trident in the unauthorized-access-2 directory
- name: Test Fuzz
working-directory: examples/fuzz-tests/unauthorized-access-2 # Set the working directory for the fuzzing test
run: trident fuzz run-afl fuzz_0 # Run the fuzz test with trident


checks:
name: Fuzz Tests (Checks)
needs: [simple-cpi-6, arbitrary-limit-inputs-5]
needs: [simple-cpi-6, arbitrary-limit-inputs-5,unauthorized-access-2]
runs-on: ubuntu-20.04
steps:
- run: echo "All fuzz tests completed successfully"
Loading

0 comments on commit 69cf63b

Please sign in to comment.