Security Checks #28
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 Checks | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| schedule: | |
| - cron: '0 0 * * 0' # Run weekly on Sundays | |
| jobs: | |
| # Static Code Analysis | |
| codeql: | |
| name: CodeQL Analysis | |
| runs-on: ubuntu-latest | |
| permissions: | |
| security-events: write | |
| actions: read | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Initialize CodeQL | |
| uses: github/codeql-action/init@v3 | |
| with: | |
| languages: javascript | |
| queries: security-and-quality | |
| - name: Perform CodeQL Analysis | |
| uses: github/codeql-action/analyze@v3 | |
| with: | |
| category: "/language:javascript" | |
| # Dependency Security | |
| dependencies: | |
| name: Dependency Checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: NPM Audit | |
| run: npm audit | |
| continue-on-error: true | |
| - name: Dependency Review | |
| uses: actions/dependency-review-action@v3 | |
| if: github.event_name == 'pull_request' | |
| # Linting and Node.js Security | |
| linting: | |
| name: Linting & Node.js Security | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: ESLint Security Checks | |
| run: npm run lint | |
| - name: NodeJSScan | |
| uses: ajinabraham/njsscan-action@master | |
| with: | |
| args: '.' | |
| # Secret Detection | |
| secrets: | |
| name: Secret Detection | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Secret Scanning | |
| uses: trufflesecurity/trufflehog@main | |
| with: | |
| extra_args: --results=verified,unknown | |
| # Security Report | |
| report: | |
| name: Security Report | |
| needs: [codeql, dependencies, linting, secrets] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Security Summary | |
| run: | | |
| echo "Security Checks Completed" | |
| echo "All parallel security checks have finished" | |
| echo "Please review results in the Security tab" |