diff --git a/.github/workflows/security_scan.yml b/.github/workflows/security_scan.yml new file mode 100644 index 0000000..ab7ebac --- /dev/null +++ b/.github/workflows/security_scan.yml @@ -0,0 +1,46 @@ +name: Security Scan + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + security_scan: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install safety bandit + + - name: Run Safety check + run: safety check -r requirements.txt + continue-on-error: true + + - name: Run Bandit + run: bandit -r . -f custom + continue-on-error: true + + - name: Run Trivy vulnerability scanner in repo mode + uses: aquasecurity/trivy-action@0.20.0 + with: + scan-type: 'fs' + ignore-unfixed: true + format: 'sarif' + output: 'trivy-results.sarif' + severity: 'CRITICAL' + + - name: Upload Trivy scan results to GitHub Security tab + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: 'trivy-results.sarif' diff --git a/requirements.txt b/requirements.txt index 70969cd..c4a1bda 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,3 +5,5 @@ requests setuptools pyinstaller torch +safety +bandit