|
| 1 | +name: Security |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + pull_request: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - main |
| 11 | + schedule: |
| 12 | + - cron: '23 4 * * 1' |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: read |
| 16 | + |
| 17 | +env: |
| 18 | + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true |
| 19 | + |
| 20 | +concurrency: |
| 21 | + group: security-${{ github.workflow }}-${{ github.ref }} |
| 22 | + cancel-in-progress: true |
| 23 | + |
| 24 | +jobs: |
| 25 | + dependency-review: |
| 26 | + name: Dependency review |
| 27 | + if: github.event_name == 'pull_request' |
| 28 | + runs-on: ubuntu-latest |
| 29 | + permissions: |
| 30 | + contents: read |
| 31 | + steps: |
| 32 | + - name: Checkout |
| 33 | + uses: actions/checkout@v4 |
| 34 | + with: |
| 35 | + persist-credentials: false |
| 36 | + |
| 37 | + - name: Dependency review |
| 38 | + uses: actions/dependency-review-action@v4 |
| 39 | + with: |
| 40 | + fail-on-severity: high |
| 41 | + |
| 42 | + audit: |
| 43 | + name: npm audit |
| 44 | + runs-on: ubuntu-latest |
| 45 | + permissions: |
| 46 | + contents: read |
| 47 | + steps: |
| 48 | + - name: Checkout |
| 49 | + uses: actions/checkout@v4 |
| 50 | + with: |
| 51 | + persist-credentials: false |
| 52 | + |
| 53 | + - name: Setup Node.js |
| 54 | + uses: actions/setup-node@v4 |
| 55 | + with: |
| 56 | + node-version: 22 |
| 57 | + cache: npm |
| 58 | + |
| 59 | + - name: Install dependencies |
| 60 | + run: npm ci |
| 61 | + |
| 62 | + - name: Audit production dependencies |
| 63 | + run: npm audit --omit=dev --audit-level=high |
| 64 | + |
| 65 | + secret-scan: |
| 66 | + name: Secret scan |
| 67 | + runs-on: ubuntu-latest |
| 68 | + permissions: |
| 69 | + contents: read |
| 70 | + steps: |
| 71 | + - name: Checkout |
| 72 | + uses: actions/checkout@v4 |
| 73 | + with: |
| 74 | + fetch-depth: 0 |
| 75 | + persist-credentials: false |
| 76 | + |
| 77 | + - name: Scan for secrets |
| 78 | + uses: gitleaks/gitleaks-action@v2 |
| 79 | + env: |
| 80 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 81 | + GITLEAKS_ENABLE_COMMENTS: false |
| 82 | + |
| 83 | + codeql: |
| 84 | + name: CodeQL |
| 85 | + runs-on: ubuntu-latest |
| 86 | + permissions: |
| 87 | + actions: read |
| 88 | + contents: read |
| 89 | + security-events: write |
| 90 | + strategy: |
| 91 | + fail-fast: false |
| 92 | + matrix: |
| 93 | + language: |
| 94 | + - javascript-typescript |
| 95 | + steps: |
| 96 | + - name: Checkout |
| 97 | + uses: actions/checkout@v4 |
| 98 | + with: |
| 99 | + fetch-depth: 0 |
| 100 | + persist-credentials: false |
| 101 | + |
| 102 | + - name: Initialize CodeQL |
| 103 | + uses: github/codeql-action/init@v3 |
| 104 | + with: |
| 105 | + languages: ${{ matrix.language }} |
| 106 | + build-mode: none |
| 107 | + |
| 108 | + - name: Perform CodeQL analysis |
| 109 | + uses: github/codeql-action/analyze@v3 |
0 commit comments