Skip to content

Rework fuzzing tests #2753

Rework fuzzing tests

Rework fuzzing tests #2753

Workflow file for this run

name: sdl
permissions: read-all
on:
workflow_dispatch:
push:
branches:
- develop
- release_v*
pull_request:
jobs:
bandit:
name: Bandit
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: 3.10.14
- name: Install bandit
run: pip install bandit[toml]==1.7.4 stevedore==5.4.1
- name: Run bandit
run: bandit -c pyproject.toml -r .
codeql:
name: CodeQL
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
lfs: true
- name: Initialize CodeQL
uses: github/codeql-action/init@16140ae1a102900babc80a33c44059580f687047 # v4.30.9
with:
languages: python
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@16140ae1a102900babc80a33c44059580f687047 # v4.30.9
with:
category: "/language:python"
# pdf reports always empty for pull_request
- name: Generate Security Report
if: ${{ github.event_name != 'pull_request' }}
uses: rsdmike/github-security-report-action@a149b24539044c92786ec39af8ba38c93496495d # v3.0.4
with:
template: report
token: ${{ secrets.GITHUB_TOKEN }}
- name: Rename Report
shell: bash
if: ${{ github.event_name != 'pull_request' }}
run: |
DATE=$(date +"%Y-%m-%d")
REF_NAME="${{ github.ref_name }}"
mv "report.pdf" "codeql_nncf_report_${DATE}_${REF_NAME//\//-}_${{ github.sha }}.pdf"
- name: Upload CodeQL Artifacts
if: ${{ github.event_name != 'pull_request' }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2
with:
name: codeql-scan-results
path: "./codeql*.pdf"
trivy:
name: Trivy
runs-on: ubuntu-latest
timeout-minutes: 10
# Skip trivy for PRs to avoid blocking merge PRs by found vulnerabilities in requirements
if: ${{ github.event_name != 'pull_request' }}
steps:
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Run trivy
uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8 # v0.33.1
with:
scan-type: "fs"
scan-ref: .
scanners: "misconfig,license,vuln"
format: template
template: "@.github/scripts/trivy_html.tpl"
output: trivy_report.html
cache: false
hide-progress: true
exit-code: 1
- name: Rename Report
if: ${{ !cancelled() }}
shell: bash
run: |
DATE=$(date +"%Y-%m-%d")
REF_NAME="${{ github.ref_name }}"
mv "trivy_report.html" "trivy_report_${DATE}_${REF_NAME//\//-}_${{ github.sha }}.html"
- name: Upload Scan Results
if: ${{ !cancelled() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2
with:
name: trivy-report
path: "./trivy_report*.html"
retention-days: 30
antivirus:
name: Antivirus
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
lfs: true
- name: Get changed files
if: ${{ github.event_name == 'pull_request' }}
id: changed-files
uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47.0.0
- name: Run ClamAV scan
id: run-clamav
uses: docker://clamav/clamav:stable
with:
entrypoint: sh
args: |
-cx "
# Update virus definitions
freshclam --quiet
# Run scan based on scope
if [ '${{ github.event_name == 'pull_request' }}' = 'true' ] && [ -n '${{ steps.changed-files.outputs.all_changed_files }}' ]; then
echo 'Running ClamAV on changed files'
SCAN_ARGS='${{ steps.changed-files.outputs.all_changed_files }}'
else
echo 'Running ClamAV on all files'
SCAN_ARGS='-r'
fi
# Run scan and capture output
clamscan $SCAN_ARGS > clamav_report.txt
"
- name: Print Scan Results
if: ${{ !cancelled() }}
shell: bash
run: cat clamav_report.txt
- name: Rename Report
if: ${{ !cancelled() }}
shell: bash
run: |
DATE=$(date +"%Y-%m-%d")
REF_NAME="${{ github.ref_name }}"
mv "clamav_report.txt" "clamav_report_${DATE}_${REF_NAME//\//-}_${{ github.sha }}.txt"
- name: Upload Scan Results
if: ${{ !cancelled() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2
with:
name: clamav-report
path: "./clamav_report*.txt"
retention-days: 30