Security #11
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: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| schedule: | |
| # Run weekly on Monday at 08:00 UTC to catch newly-published CVEs | |
| - cron: '0 8 * * 1' | |
| workflow_dispatch: | |
| jobs: | |
| dependency-audit: | |
| name: Dependency audit (pip-audit) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Cache pip | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-security-${{ hashFiles('requirements.txt') }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pip-audit | |
| pip install -r requirements.txt | |
| - name: Audit dependencies for known CVEs | |
| run: | | |
| pip-audit --requirement requirements.txt --strict | |
| sast: | |
| name: Static analysis (bandit) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install bandit | |
| run: pip install bandit[toml] | |
| - name: Run bandit SAST scan | |
| run: | | |
| bandit -r urlrecon/ \ | |
| --severity-level medium \ | |
| --confidence-level medium \ | |
| --format json \ | |
| --output bandit-report.json || true | |
| # Print a human-readable summary and fail on high-severity findings | |
| bandit -r urlrecon/ \ | |
| --severity-level high \ | |
| --confidence-level high \ | |
| --exit-zero | |
| - name: Upload bandit report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bandit-report | |
| path: bandit-report.json | |
| retention-days: 14 |