Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 124 additions & 0 deletions .github/workflows/security.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: Security Scan

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

permissions:
contents: read
security-events: write

jobs:

security:
runs-on: ubuntu-latest

steps:

########################################
# Checkout
########################################

- name: Checkout repository
uses: actions/checkout@v4

########################################
# Python setup
########################################

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install Python security tools
run: |
pip install bandit pip-audit safety

########################################
# Python code scan
########################################

- name: Bandit scan
run: |
bandit -c .github/security/bandit.yml -r . -f json -o bandit-report.json

########################################
# Python dependency scan
########################################

- name: pip-audit dependencies
run: |
pip-audit -r requirements.txt -f json -o pip-audit-report.json || true

########################################
# Node setup
########################################

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Install JS dependencies
run: |
if [ -f package.json ]; then
npm install
fi

########################################
# NPM vulnerability scan
########################################

- name: NPM audit
run: |
if [ -f package.json ]; then
npm audit --audit-level=high
fi

########################################
# ESLint security scan
########################################

- name: ESLint security
run: |
if [ -f package.json ]; then
npm install eslint eslint-plugin-security
npx eslint . -c .github/security/eslint-security.json || true
fi

########################################
# Secrets scanning
########################################

- name: Gitleaks scan
uses: gitleaks/gitleaks-action@v2

########################################
# Trivy vulnerability scan
########################################

- name: Trivy filesystem scan
uses: aquasecurity/trivy-action@0.20.0
with:
scan-type: fs
scan-ref: .
config: .github/security/trivy.yaml

########################################
# Upload reports
########################################

- name: Upload Bandit report
uses: actions/upload-artifact@v4
with:
name: bandit-report
path: bandit-report.json

- name: Upload pip-audit report
uses: actions/upload-artifact@v4
with:
name: pip-audit-report
path: pip-audit-report.json
Loading