Skip to content

Fuzzing

Fuzzing #85

Workflow file for this run

name: Fuzzing
on:
schedule:
- cron: '0 7 * * 1' # Runs at 07:00 on monday every week
workflow_dispatch:
permissions:
contents: read
jobs:
fuzzing:
name: Fuzzing
runs-on: ${{ github.repository_owner == 'intel' && 'intel-ubuntu-latest' || 'ubuntu-latest' }}
if: github.event.repository.fork == false
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/[email protected]
with:
python-version: 3.10.16
- name: Install Build Dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential gcc g++ cmake
- name: Install newer GCC
run: |
sudo apt-get update
sudo apt-get install -y gcc-10 g++-10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 100
- name: Set up compiler environment
run: |
export CC=gcc
export CXX=g++
- name: Install Bazel
run: |
sudo apt-get update
sudo apt-get install -y wget
wget -c https://github.com/bazelbuild/bazel/releases/download/7.4.1/bazel-7.4.1-linux-x86_64
chmod +x bazel-7.4.1-linux-x86_64
sudo mv bazel-7.4.1-linux-x86_64 /usr/local/bin/bazel
bazel --version
- name: Install Fuzzing Dependencies
run: |
pip install --upgrade atheris
pip install --upgrade atheris-libprotobuf-mutator -v
pip install --upgrade protobuf
- name: Install Cve-bin-tool
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install --upgrade -r dev-requirements.txt
python -m pip install --upgrade .
- name: Get date
id: get-date
run: |
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT
echo "yesterday=$(/bin/date -d "-1 day" -u "+%Y%m%d")" >> $GITHUB_OUTPUT
- name: Get today's cached database
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
id: todays-cache
with:
path: fuzz-cache
key: Linux-cve-bin-tool-${{ steps.get-date.outputs.date }}
- name: Get yesterday's cached database if today's is not available
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
if: steps.todays-cache.outputs.cache-hit != 'true'
with:
path: fuzz-cache
key: Linux-cve-bin-tool-${{ steps.get-date.outputs.yesterday }}
- name: Try single CLI run of tool
if: env.sbom != 'true'
run: |
[[ -e fuzz-cache ]] && mkdir -p .cache && mv fuzz-cache ~/.cache/cve-bin-tool
NO_EXIT_CVE_NUM=1 python -m cve_bin_tool.cli test/assets/test-kerberos-5-1.15.1.out --disable-data-source CURL,EPSS,GAD,NVD,OSV,PURL2CPE,RSD
cp -r ~/.cache/cve-bin-tool fuzz-cache
- name: Run Fuzzing
id: fuzzing
env:
PYTHONPATH: ${{ github.workspace }}
run: |
cd fuzz
export PYTHONPATH="$PYTHONPATH:/generated"
fuzzing_scripts=($(ls *.py))
echo "Found Fuzzing scripts: ${fuzzing_scripts[@]}"
current_week=($(date -u +%U))
echo "Current week number: $current_week"
at_index=$(((10#$(date -u +%U)) % ${#fuzzing_scripts[@]}))
selected_script="${fuzzing_scripts[$at_index]}"
echo "Selected script: $selected_script"
timeout --preserve-status --signal=SIGINT 60m python $selected_script