Security #17
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 | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - '**.py' | |
| - 'requirements.txt' | |
| - '.github/workflows/security.yml' | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - '**.py' | |
| - 'requirements.txt' | |
| - '.github/workflows/security.yml' | |
| schedule: | |
| # Run weekly security scans | |
| - cron: '0 0 * * 0' | |
| jobs: | |
| security: | |
| name: Security Checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install bandit[toml] safety | |
| pip install -r requirements.txt | |
| - name: Run Bandit (security issues) | |
| run: | | |
| bandit -r . -f json -o bandit-report.json --exclude ./.venv,./.pytest_cache || true | |
| bandit -r . -f screen --exclude ./.venv,./.pytest_cache | |
| - name: Run Safety (dependency vulnerabilities) | |
| run: | | |
| safety check || true | |
| - name: Upload Bandit results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bandit-report | |
| path: bandit-report.json | |
| retention-days: 30 |