Release/5.0.0 #6
This file contains hidden or 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: Security Scan | |
on: | |
schedule: | |
- cron: '0 2 * * 1' # Run every Monday at 2 AM | |
push: | |
branches: [ main, develop ] | |
pull_request: | |
branches: [ main, develop ] | |
jobs: | |
security: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@master | |
with: | |
scan-type: 'fs' | |
scan-ref: '.' | |
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' | |
dependency-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install safety | |
run: | | |
pip install safety | |
- name: Check Python dependencies | |
run: | | |
cd src/backend | |
safety check --json --output safety-report.json || echo "Safety check completed" | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
- name: Install npm audit | |
run: | | |
cd src/frontend | |
npm audit --audit-level=moderate || echo "npm audit completed" | |
docker-security: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Build Docker image for scanning | |
run: | | |
cd src/backend | |
docker build -t llmchatbot-backend:security-scan . | |
- name: Run Trivy on Docker image | |
uses: aquasecurity/trivy-action@master | |
with: | |
image-ref: 'llmchatbot-backend:security-scan' | |
format: 'sarif' | |
output: 'trivy-docker-results.sarif' | |
- name: Upload Docker scan results | |
uses: github/codeql-action/upload-sarif@v2 | |
if: always() | |
with: | |
sarif_file: 'trivy-docker-results.sarif' |