Skip to content

Commit

Permalink
Add security workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanleung committed Oct 8, 2024
1 parent e89a0ca commit f9dba45
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/security_scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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

- name: Run Bandit
run: bandit -r . -f custom

- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
ignore-unfixed: true
format: 'sarif'
output: 'trivy-results.sarif'

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
if: always()
with:
sarif_file: 'trivy-results.sarif'
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ requests
setuptools
pyinstaller
torch
safety
bandit

0 comments on commit f9dba45

Please sign in to comment.