From d4034c9caaa2ac4bdc42da02ecc5d93db716f0db Mon Sep 17 00:00:00 2001 From: martincostello Date: Fri, 15 Aug 2025 15:15:11 +0100 Subject: [PATCH] Add zizmor Scan GitHub Actions workflows with zizmor and fix/suppress findings. --- .github/workflows/build.yml | 1 + .github/workflows/bump-version.yml | 1 + .github/workflows/codeql.yml | 1 + .github/workflows/dependency-review.yml | 1 + .github/workflows/lint.yml | 19 ++++++++++++++++--- .github/workflows/ossf-scorecard.yml | 2 +- .github/workflows/release.yml | 1 + 7 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 34c0e03f..35015fc3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,6 +56,7 @@ jobs: uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: filter: 'tree:0' + persist-credentials: false show-progress: false - name: Setup .NET SDK diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index c44543d7..0b6707e7 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -27,6 +27,7 @@ jobs: uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: filter: 'tree:0' + persist-credentials: true # zizmor: ignore[artipacked] Needed to push commits show-progress: false token: ${{ secrets.COSTELLOBOT_TOKEN }} diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 568e0a5d..5fbfafe3 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -33,6 +33,7 @@ jobs: uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: filter: 'tree:0' + persist-credentials: false show-progress: false - name: Initialize CodeQL diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 285e3122..01ead866 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -20,6 +20,7 @@ jobs: uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: filter: 'tree:0' + persist-credentials: false show-progress: false - name: Review dependencies diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 23915f22..f987177c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -14,8 +14,7 @@ on: - dotnet-nightly workflow_dispatch: -permissions: - contents: read +permissions: {} env: FORCE_COLOR: 3 @@ -24,27 +23,41 @@ env: # renovate: datasource=github-releases depName=PSScriptAnalyzer packageName=PowerShell/PSScriptAnalyzer PSSCRIPTANALYZER_VERSION: '1.24.0' TERM: xterm + # renovate: datasource=github-releases depName=zizmor packageName=zizmorcore/zizmor + ZIZMOR_VERSION: '1.12.0' jobs: lint: runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + steps: - name: Checkout code uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: filter: 'tree:0' + persist-credentials: false show-progress: false - name: Add actionlint problem matcher run: echo "::add-matcher::.github/actionlint-matcher.json" - - name: Lint workflows + - name: Lint workflows with actionlint uses: docker://rhysd/actionlint:1.7.7@sha256:887a259a5a534f3c4f36cb02dca341673c6089431057242cdc931e9f133147e9 with: args: -color + - name: Lint workflows with zizmor + uses: zizmorcore/zizmor-action@5ca5fc7a4779c5263a3ffa0e1f693009994446d1 # v0.1.2 + with: + persona: pedantic + version: ${{ env.ZIZMOR_VERSION }} + - name: Lint markdown uses: DavidAnson/markdownlint-cli2-action@992badcdf24e3b8eb7e87ff9287fe931bcb00c6e # v20.0.0 with: diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index bb65a969..8c3f827c 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -8,7 +8,7 @@ on: - cron: '0 5 * * MON' workflow_dispatch: -permissions: read-all +permissions: read-all # zizmor: ignore[excessive-permissions] Recommended permissions for OSSF Scorecard jobs: analysis: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e60d73ce..dd84d425 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,6 +25,7 @@ jobs: uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: filter: 'tree:0' + persist-credentials: true # zizmor: ignore[artipacked] Needed to push commits show-progress: false token: ${{ secrets.COSTELLOBOT_TOKEN }}