|
| 1 | +--- |
| 2 | +# Static analysis of GitHub Actions workflows. |
| 3 | +# |
| 4 | +# Inspired by Astral's open-source security guidance: |
| 5 | +# https://astral.sh/blog/open-source-security-at-astral |
| 6 | +# |
| 7 | +# zizmor catches misuses such as template injection, credential leaks, |
| 8 | +# excessive permissions, dangerous triggers and impostor commits. It is |
| 9 | +# a hard CI gate: a failed audit blocks the pull request. |
| 10 | +name: GitHub Actions Security Audit |
| 11 | +concurrency: |
| 12 | + cancel-in-progress: true |
| 13 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 14 | +on: |
| 15 | + pull_request: |
| 16 | + branches: |
| 17 | + - main |
| 18 | + paths: |
| 19 | + - .github/** |
| 20 | + - zizmor.yaml |
| 21 | + push: |
| 22 | + branches: |
| 23 | + - main |
| 24 | + paths: |
| 25 | + - .github/** |
| 26 | + - zizmor.yaml |
| 27 | + schedule: |
| 28 | + # Re-audit weekly so newly published advisories surface even if |
| 29 | + # no workflow file has changed. |
| 30 | + - cron: "0 6 * * 1" |
| 31 | +permissions: {} |
| 32 | +jobs: |
| 33 | + zizmor: |
| 34 | + name: zizmor |
| 35 | + runs-on: ubuntu-latest |
| 36 | + permissions: |
| 37 | + contents: read |
| 38 | + # Required so zizmor can upload SARIF results to GitHub Code |
| 39 | + # Scanning. Drop this permission if Code Scanning is unavailable. |
| 40 | + security-events: write |
| 41 | + steps: |
| 42 | + - name: Checkout repository |
| 43 | + uses: actions/checkout@v6 |
| 44 | + with: |
| 45 | + persist-credentials: false |
| 46 | + # zizmor is installed via pipx (preinstalled on ubuntu-latest) |
| 47 | + # rather than a third-party action so the security workflow has |
| 48 | + # the smallest possible supply chain. |
| 49 | + - name: Install zizmor |
| 50 | + run: pipx install zizmor |
| 51 | + - name: Run zizmor |
| 52 | + env: |
| 53 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 54 | + run: zizmor --format=sarif --min-severity=low . > zizmor.sarif |
| 55 | + - name: Upload SARIF file |
| 56 | + if: ${{ !cancelled() }} |
| 57 | + uses: github/codeql-action/upload-sarif@v4 |
| 58 | + with: |
| 59 | + sarif_file: zizmor.sarif |
| 60 | + category: zizmor |
0 commit comments