Skip to content

ci: add zizmor, fix found issues - #5387

Open
kolyshkin wants to merge 7 commits into
opencontainers:mainfrom
kolyshkin:add-zizmor
Open

ci: add zizmor, fix found issues#5387
kolyshkin wants to merge 7 commits into
opencontainers:mainfrom
kolyshkin:add-zizmor

Conversation

@kolyshkin

@kolyshkin kolyshkin commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

This is based on top of (and currently includes) #5385, thus the draft status. Will rebase once that one is merged.

Add a zizmor job to CI, and fix everything it finds (including a few
--persona=pedantic findings). See individual commits for details.

  • ci: pin actions to commit hashes -- version tags are mutable, hashes are
    not; dependabot already knows how to bump them.
  • ci: harden workflows as suggested by zizmor -- persist-credentials: false
    for actions/checkout, cache: false for actions/setup-go.
  • dependabot: add cooldown.
  • ci: add zizmor job -- pinned version, inline annotations only (so the job
    stays at contents: read).
  • ci: narrow down scheduled.yml permissions -- move actions: write to the
    only job that needs it.
  • ci: add concurrency limits -- cancel superseded PR runs; keyed by PR number,
    so pushes to main/release-/v tags are never cancelled.
  • ci: drop unused job permission -- lint does not need pull-requests: read.

@kolyshkin

Copy link
Copy Markdown
Contributor Author

Rebased; no longer a draft; PTAL @opencontainers/runc-maintainers

@kolyshkin
kolyshkin requested review from lifubang and rata and removed request for lifubang August 19, 2026 09:31
Comment thread .github/workflows/validate.yml Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed

kolyshkin and others added 7 commits August 24, 2026 23:00
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.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Two things, both applied by "zizmor --fix":

 - 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.

 - cache: false for actions/setup-go. These workflows are also triggered
   by pushing a v* tag, and validate.yml builds and uploads release
   binaries, so a cache entry poisoned from a pull request could in
   principle end up in a release build.

The remaining cache-poisoning finding (Lima VM images in test.yml) is
ignored inline: it caches downloaded VM images rather than build output,
and the suggested lookup-only: true would defeat the cache entirely by
re-downloading the image on every run.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
As recommended by zizmor.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
zizmor is a static analysis tool for GitHub Actions workflows, focused
on security issues rather than correctness (which is what the separate
actionlint job is for).

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.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Move "actions: write" from the workflow level to the only job that needs
it, so a job added later won't silently inherit it.

Found by zizmor's excessive-permissions audit (--persona=pedantic).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Cancel CI runs that are already superseded, rather than letting them run
to completion and waste runner time. This is most of what our CI queue
is spent on when a pull request is force-pushed a few times in a row.

For the three workflows that run on pull requests, 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, the latter also producing the release binaries -- 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.

scheduled.yml only triggers other workflows, so a single group for the
whole workflow is enough there.

Found by zizmor's concurrency-limits audit (--persona=pedantic).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
The lint job does not need read permission: golangci-lint-action only uses
pull-requests: read 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).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@kolyshkin kolyshkin added this to the 1.6.0 milestone Aug 25, 2026
@kolyshkin kolyshkin added the backport/1.5-todo A PR in main branch which needs to be backported to release-1.5 label Aug 25, 2026

@thaJeztah thaJeztah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall looks good; left two questions

Comment on lines 228 to +239
- 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

# This caches downloaded Lima VM images, not build output, and this job
# does not produce anything that is released. The fix suggested by zizmor
# (lookup-only: true) would re-download the image on every run.
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
with: # zizmor: ignore[cache-poisoning]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if changing the order works, and would avoid some of the warning; first setup lima, then checkout the source code? (not sure at what point information from the branch / commit is needed)

Comment on lines +13 to +16
# There is no point in triggering the downstream workflows twice.
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this cancel other (release) branches if they're also scheduled?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ci backport/1.5-todo A PR in main branch which needs to be backported to release-1.5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants