Skip to content

Merge pull request #81 from devops-stack/develop #51

Merge pull request #81 from devops-stack/develop

Merge pull request #81 from devops-stack/develop #51

Workflow file for this run

name: Security Scan
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: read
security-events: write
jobs:
security:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
if: always()
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install Python security tools
if: always()
continue-on-error: true
run: |
pip install bandit pip-audit safety || true
- name: Bandit scan
if: always()
continue-on-error: true
run: |
bandit -c .github/workflows/security/bandit.yml -r . -f json -o bandit-report.json || true
- name: pip-audit dependencies
if: always()
continue-on-error: true
run: |
if [ -f requirements.txt ]; then
pip-audit -r requirements.txt -f json -o pip-audit-report.json || true
fi
- name: Setup Node
if: always()
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install JS dependencies
if: always()
continue-on-error: true
run: |
if [ -f package.json ]; then
npm install || true
fi
- name: NPM audit
if: always()
continue-on-error: true
run: |
if [ -f package.json ]; then
npm audit --audit-level=high || true
fi
- name: ESLint security scan
if: always()
continue-on-error: true
run: |
if [ -f package.json ]; then
npm install eslint eslint-plugin-security || true
npx eslint . -c .github/workflows/security/eslint-security.json || true
fi
- name: Gitleaks scan
if: always()
continue-on-error: true
uses: gitleaks/gitleaks-action@v2
- name: Trivy filesystem scan
if: always()
continue-on-error: true
uses: aquasecurity/trivy-action@0.20.0
with:
scan-type: fs
scan-ref: .
config: .github/workflows/security/trivy.yaml
- name: Upload Bandit report
if: always()
uses: actions/upload-artifact@v4
with:
name: bandit-report
path: bandit-report.json
if-no-files-found: ignore
- name: Upload pip-audit report
if: always()
uses: actions/upload-artifact@v4
with:
name: pip-audit-report
path: pip-audit-report.json
if-no-files-found: ignore