From 5b12076a66137780a0c458639db7a8a1de7ab6da Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Mon, 19 Oct 2026 01:06:04 -0700 Subject: [PATCH 1/6] ci: pin actions to commit hashes A version tag (even a "full" one like v7.0.1) is mutable: whoever controls the action's repository can move it to point to any other commit. Pinning to a full commit hash is the only way to get the exact same action code on every run. Found by zizmor's unpinned-uses audit. Dependabot is already enabled for the github-actions ecosystem and knows how to update hash pins together with their version comments, so this should not add maintenance burden. Signed-off-by: Kir Kolyshkin --- .github/workflows/test.yml | 10 +++++----- .github/workflows/validate.yml | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 77de70c..4472e14 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,8 +28,8 @@ jobs: runs-on: ubuntu-26.04 steps: - - uses: actions/checkout@v7 - - uses: actions/setup-go@v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: go-version: ${{ matrix.go-version }} go-version-file: go.mod # Take version from go.mod when go-version is empty. @@ -40,12 +40,12 @@ jobs: timeout-minutes: 20 runs-on: ubuntu-26.04 steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - uses: lima-vm/lima-actions/setup@v1 + - uses: lima-vm/lima-actions/setup@55627e31b78637bf254a8b2a14da8ea7d12564e5 # v1.1.0 id: lima-actions-setup - - uses: actions/cache@v6 + - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: ~/.cache/lima key: lima-${{ steps.lima-actions-setup.outputs.version }} diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 71accb3..d07e241 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -22,13 +22,13 @@ jobs: checks: write # to allow the action to annotate code in the PR. runs-on: ubuntu-26.04 steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 2 - - uses: actions/setup-go@v7 + - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: go-version: stable - - uses: golangci/golangci-lint-action@v9 + - uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0 # Extra linters, only checking new code from a pull request. - name: lint-extra if: github.event_name == 'pull_request' @@ -38,7 +38,7 @@ jobs: codespell: runs-on: ubuntu-26.04 steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: install deps # Use a known version of codespell. run: pip install --break-system-packages codespell==v2.4.3 @@ -48,14 +48,14 @@ jobs: space-at-eol: runs-on: ubuntu-26.04 steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - run: if git -P grep -I -n '\s$'; then echo "^^^ extra whitespace at EOL, please fix"; exit 1; fi deps: runs-on: ubuntu-26.04 steps: - - uses: actions/checkout@v7 - - uses: actions/setup-go@v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: go-version: stable - run: go mod tidy --diff @@ -63,7 +63,7 @@ jobs: govulncheck: runs-on: ubuntu-26.04 steps: - - uses: golang/govulncheck-action@v1 + - uses: golang/govulncheck-action@032d45514ae346b1db93c04b0c90b841c370344f # v1.1.0 all-done: needs: From c268a6cf7c30a8e1d6b4771af890c6cfecf751d4 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Mon, 19 Oct 2026 01:06:19 -0700 Subject: [PATCH 2/6] ci: harden workflows as suggested by zizmor Set persist-credentials: false for actions/checkout. By default checkout leaves the credentials it used in .git/config, where any later step (or anything that archives the workspace) can pick them up. Nothing here pushes back to the repository, so they are not needed. The remaining findings are all cache-poisoning, and are ignored via .github/zizmor.yml, which explains why they do not apply to us. Signed-off-by: Kir Kolyshkin --- .github/workflows/test.yml | 4 ++++ .github/workflows/validate.yml | 7 +++++++ .github/zizmor.yml | 24 ++++++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 .github/zizmor.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4472e14..ee371c5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,6 +29,8 @@ jobs: steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: go-version: ${{ matrix.go-version }} @@ -41,6 +43,8 @@ jobs: runs-on: ubuntu-26.04 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - uses: lima-vm/lima-actions/setup@55627e31b78637bf254a8b2a14da8ea7d12564e5 # v1.1.0 id: lima-actions-setup diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index d07e241..944a32d 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -24,6 +24,7 @@ jobs: steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: + persist-credentials: false fetch-depth: 2 - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: @@ -39,6 +40,8 @@ jobs: runs-on: ubuntu-26.04 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: install deps # Use a known version of codespell. run: pip install --break-system-packages codespell==v2.4.3 @@ -49,12 +52,16 @@ jobs: runs-on: ubuntu-26.04 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - run: if git -P grep -I -n '\s$'; then echo "^^^ extra whitespace at EOL, please fix"; exit 1; fi deps: runs-on: ubuntu-26.04 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: go-version: stable diff --git a/.github/zizmor.yml b/.github/zizmor.yml new file mode 100644 index 0000000..77224a4 --- /dev/null +++ b/.github/zizmor.yml @@ -0,0 +1,24 @@ +# Configuration for zizmor (https://docs.zizmor.sh/), run by the zizmor job +# in .github/workflows/validate.yml. + +rules: + cache-poisoning: + # The audit fires because both workflows are also triggered by pushing a + # v* tag, so anything they cache is, in zizmor's view, a possible input to + # a release build. That does not hold here: + # + # - This is a library: no job produces any release artifacts, and the + # workflows only run tests and linters. + # + # - GitHub scopes caches per branch: a pull request can read the default + # branch's cache, but cannot write to it. So a pull request cannot plant + # an entry that a later push or tag build would restore. + # + # The alternative (cache: false everywhere) makes every Go job re-download + # modules and start from a cold build cache, which is a real slowdown for + # no gain. + # + # Revisit this if a job ever starts publishing artifacts. + ignore: + - test.yml + - validate.yml From 415e896cf23263f442324d19732aa87451320e1f Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Mon, 19 Oct 2026 01:06:19 -0700 Subject: [PATCH 3/6] dependabot: add cooldown As recommended by zizmor. Signed-off-by: Kir Kolyshkin --- .github/dependabot.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 807baca..d770afb 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,3 +8,5 @@ updates: directory: "/" schedule: interval: "daily" + cooldown: + default-days: 7 From 54f3f99b3f632ab63aba75bf32ff1c23c4580d8f Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Mon, 19 Oct 2026 01:06:25 -0700 Subject: [PATCH 4/6] ci: add zizmor job zizmor is a static analysis tool for GitHub Actions workflows, focused on security issues. Use the official action, which runs zizmor from a digest-pinned container image. A few non-default settings: - version: pin it, so a new zizmor release adding new audits does not suddenly fail CI on an unrelated pull request. Bumping it is then a deliberate (and dependabot-able) change. - advanced-security: false + annotations: true. The default uploads SARIF to the repository's security tab, which needs the job to have security-events: write. Inline annotations are enough for us and keep the workflow at contents: read. Signed-off-by: Kir Kolyshkin --- .github/workflows/validate.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 944a32d..8d4a3ae 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -72,6 +72,18 @@ jobs: steps: - uses: golang/govulncheck-action@032d45514ae346b1db93c04b0c90b841c370344f # v1.1.0 + zizmor: + runs-on: ubuntu-26.04 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: zizmorcore/zizmor-action@cc914d7f3750a2d13d75c7f184a1060aa0e9d482 # v0.6.4 + with: + version: 1.30.0 + advanced-security: false + annotations: true + all-done: needs: - codespell @@ -79,6 +91,7 @@ jobs: - govulncheck - lint - space-at-eol + - zizmor runs-on: ubuntu-26.04 steps: - run: echo "All jobs completed" From 28c7588f4d2c79a8f87215bb8faf7dab39f85e19 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Mon, 19 Oct 2026 01:06:39 -0700 Subject: [PATCH 5/6] ci: add concurrency limits Cancel CI runs that are already superseded, rather than letting them run to completion and waste runner time. The concurrency group is keyed by PR number, so only runs of the same pull request cancel each other. For anything else -- in particular pushes to main, to release-*, and to a v* tag -- there is no PR number, so the group falls back to the unique run_id and no run is ever cancelled. Keying by github.head_ref instead would be wrong, as two pull requests from different forks can use the same branch name. Found by zizmor's concurrency-limits audit (--persona=pedantic). Signed-off-by: Kir Kolyshkin --- .github/workflows/test.yml | 4 ++++ .github/workflows/validate.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ee371c5..dd57438 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,6 +13,10 @@ on: permissions: contents: read +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: true + jobs: cgroup-v2: name: "cgroup v2 (Ubuntu 26.04)" diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 8d4a3ae..7d3c92e 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -13,6 +13,10 @@ on: permissions: contents: read +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: true + jobs: lint: timeout-minutes: 30 From b374154ed30c0cfb93661e7d656abbc5bebee09e Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Mon, 19 Oct 2026 01:06:48 -0700 Subject: [PATCH 6/6] ci: fix up job permissions The lint job does not need pull-requests: read: golangci-lint-action only uses it for its only-new-issues option, which we do not set. The lint-extra step does its own "new code only" filtering with --new-from-rev=HEAD~1, which is plain git against the fetch-depth: 2 checkout, and the PR annotations come from checks: write. Found by zizmor's undocumented-permissions audit (--persona=pedantic). Signed-off-by: Kir Kolyshkin --- .github/workflows/validate.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 7d3c92e..461208a 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -22,7 +22,6 @@ jobs: timeout-minutes: 30 permissions: contents: read - pull-requests: read checks: write # to allow the action to annotate code in the PR. runs-on: ubuntu-26.04 steps: