Fuzzing #45
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/setup-python@v5.2.0 | |
with: | |
python-version: 3.9 | |
- name: Install Bazel | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y wget | |
wget -c https://github.com/bazelbuild/bazelisk/releases/download/v1.18.0/bazelisk-linux-amd64 | |
chmod +x bazelisk-linux-amd64 | |
sudo mv bazelisk-linux-amd64 /usr/local/bin/bazel | |
bazel --version | |
- name: Install Fuzzing Dependencies | |
run: | | |
pip install --upgrade atheris | |
pip install --upgrade atheris-libprotobuf-mutator | |
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@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
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@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
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 | |
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=$((($(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 |