Update security-scan.yml #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 Scanning | |
| on: | |
| schedule: | |
| - cron: '0 6 * * 1' # Every Monday at 6 AM | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| security-scan: | |
| name: π Comprehensive Security Scan | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: π₯ Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Needed for TruffleHog to compare commits | |
| - name: ποΈ Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18.x' | |
| cache: 'npm' | |
| - name: π¦ Install dependencies | |
| run: npm ci | |
| - name: π NPM Audit | |
| run: | | |
| npm audit --audit-level=high || true | |
| npm audit fix --dry-run || true | |
| - name: π¨ Snyk Security Scan | |
| uses: snyk/actions/node@master | |
| env: | |
| SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | |
| with: | |
| args: --severity-threshold=high --sarif-file-output=snyk.sarif | |
| - name: π Snyk Code Scan | |
| uses: snyk/actions/node@master | |
| env: | |
| SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | |
| with: | |
| args: code test --sarif-file-output=snyk-code.sarif | |
| - name: π Upload Snyk Reports | |
| uses: github/codeql-action/upload-sarif@v3 | |
| with: | |
| sarif_file: snyk.sarif | |
| continue-on-error: true # Don't fail if SARIF upload fails | |
| - name: π Upload Snyk Code Reports | |
| uses: github/codeql-action/upload-sarif@v3 | |
| with: | |
| sarif_file: snyk-code.sarif | |
| continue-on-error: true | |
| - name: π Secret Scanning | |
| uses: trufflesecurity/trufflehog-github-actions@main | |
| with: | |
| path: ./ | |
| base: ${{ github.event.before }} | |
| head: ${{ github.event.after }} | |
| - name: π‘οΈ OWASP Dependency Check | |
| uses: dependency-check/[email protected] # Fixed version | |
| with: | |
| project: 'EM-Zilla' | |
| path: ./ | |
| format: 'HTML' | |
| out: 'reports/' | |
| - name: π€ Upload Security Report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: security-reports | |
| path: | | |
| reports/ | |
| *.sarif | |
| retention-days: 90 |