Security Scan #167
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: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main, develop] | |
| schedule: | |
| # Run security scan daily at 2 AM UTC | |
| - cron: "0 2 * * *" | |
| jobs: | |
| security-scan: | |
| name: Security Analysis | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: read | |
| contents: read | |
| security-events: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| version: latest | |
| - name: Install dependencies | |
| run: ./scripts/install.sh | |
| # Python security scanning | |
| - name: Run Bandit Security Scan | |
| run: | | |
| uv pip install bandit[toml] | |
| bandit -r packages/*/src/ -f sarif -o bandit-results.sarif || true | |
| - name: Upload Bandit results to GitHub Security Tab | |
| uses: github/codeql-action/upload-sarif@v3 | |
| if: always() | |
| with: | |
| sarif_file: bandit-results.sarif | |
| # Dependency vulnerability scanning | |
| - name: Run Safety check | |
| run: | | |
| uv pip install safety | |
| safety check --json --output safety-report.json || true | |
| - name: Upload Safety results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: safety-scan-results | |
| path: safety-report.json | |
| # Frontend security scanning | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "18" | |
| - name: Install frontend dependencies | |
| run: | | |
| cd packages/frontend | |
| npm ci | |
| - name: Run npm audit | |
| run: | | |
| cd packages/frontend | |
| npm audit --audit-level=high --json > ../frontend-audit.json || true | |
| - name: Upload npm audit results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: npm-audit-results | |
| path: packages/frontend-audit.json | |
| # CodeQL Analysis | |
| - name: Initialize CodeQL | |
| uses: github/codeql-action/init@v3 | |
| with: | |
| languages: python, javascript | |
| - name: Perform CodeQL Analysis | |
| uses: github/codeql-action/analyze@v3 | |
| with: | |
| category: "/language:python,javascript" |