Skip to content

ci: least-privilege tokens, pinned actions and a workflow linter - #573

Merged
LeMyst merged 1 commit into
cooklang:mainfrom
LeMyst:ci/harden-workflows
Sep 28, 2026
Merged

LeMyst merged 1 commit into
cooklang:mainfrom
LeMyst:ci/harden-workflows

Conversation

@LeMyst

@LeMyst LeMyst commented Sep 28, 2026

Copy link
Copy Markdown
Collaborator

Closes #572.

Stacked on #571 (which is stacked on #569). Only 429be2d is new here. The three branches touch the same workflow files, so they build on each other rather than conflict. Merge in order: #569, #571, then this.

What changes

Token permissions (release.yaml)

job before after
workflow default contents/pull-requests/packages write, id-token write contents read
release_please (inherited) contents, pull-requests: write
github_build ×11, source_tarball, rpm_build (inherited) default (read)
upload_artifacts (inherited) contents: write
publish_crates (inherited) id-token: write (crates.io trusted publishing)
docker_publish / docker_merge (inherited) packages: write

test.yml also gets a read-only default.

Pinning. Every uses: points at a commit SHA with # vX.Y.Z beside it, the form Dependabot's github-actions updater maintains.

  • dtolnay/rust-toolchain@stable becomes the v1 commit with toolchain: stable as an input.
  • taiki-e/install-action@cross becomes v2.87.21 with tool: cross.

Smaller fixes

  • persist-credentials: false on all checkouts. claude-code-action installs its own git credential and handles a checkout without one.
  • npm ci in the release, source tarball, crates.io and RPM builds.
  • The release tag reaches gh release edit through env.
  • timeout-minutes on every release job, sized from the v0.37.0 run. The longest job, the notarized macOS x86_64 build, took 24 minutes; it gets 90 because notarization may wait 30.

New workflow-lint.yml runs on changes under .github/:

  • actionlint 1.7.12: the release tarball, verified against its published SHA-256.
  • zizmor 1.30.1, through the pinned install-action. Online audits use the job's read-only token. Informational findings are left out.
  • fedora:latest in rpm.yaml stays unpinned on purpose, with an inline zizmor: ignore and the reason next to it.

Testing

  • actionlint 1.7.12: no output.
  • zizmor 1.30.1 (--min-severity=low, offline): "No findings to report" (116 before). The online audits will run for the first time in this PR's own Workflow lint check.
  • I ran the actionlint install step locally: the checksum verifies and the binary reports 1.7.12.
  • The release jobs can only be exercised by a release. The permission table above lists what each job used before and still has.

🤖 Generated with Claude Code

zizmor reported 116 findings on the workflows; none remain at low
severity or above.

- release.yaml: the workflow-wide token could write contents, pull
  requests and packages and mint OIDC tokens in every job, including the
  eleven build jobs that run npm and cargo build scripts from
  dependencies. It is read-only now, and each job asks for what it uses:
  release-please (contents, pull-requests), upload_artifacts (contents),
  publish_crates (id-token), docker (packages). test.yml gets a
  read-only token too.
- Every action is pinned to a commit SHA with its version in a comment,
  which Dependabot keeps updating. dtolnay/rust-toolchain now takes the
  toolchain as an input, taiki-e/install-action takes `tool: cross`.
- Checkouts no longer leave the token in .git/config.
- `npm ci` instead of `npm install` in release and RPM builds, so the
  shipped assets come from the lockfile.
- The release tag reaches `gh release edit` through the environment
  rather than being spliced into the script.
- timeout-minutes on every release job.
- New workflow-lint.yml runs actionlint and zizmor on changes under
  .github/. fedora:latest in rpm.yaml stays unpinned on purpose, with an
  inline zizmor ignore saying why.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@LeMyst
LeMyst force-pushed the ci/harden-workflows branch from 3684331 to 9c29c0b Compare September 28, 2026 20:29
@LeMyst
LeMyst merged commit 24b94bd into cooklang:main Sep 28, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI: release jobs all hold write tokens, actions unpinned (zizmor: 116 findings)

1 participant