Skip to content

Add explicit permissions to linting, unit test, and doc link workflows#5075

Open
qubeena07 wants to merge 7 commits into
zenml-io:developfrom
qubeena07:fix/actions-permissions-audit
Open

Add explicit permissions to linting, unit test, and doc link workflows#5075
qubeena07 wants to merge 7 commits into
zenml-io:developfrom
qubeena07:fix/actions-permissions-audit

Conversation

@qubeena07

Copy link
Copy Markdown
Contributor

Summary

First batch of the workflow permissions audit tracked in #4658.

These five workflows relied on the default GITHUB_TOKEN permissions, which are broader than they need:

  • linting.yml
  • unit test.yml
  • spellcheck.yml
  • check links.yml
  • check markdown links.yml

Each now declares an empty workflow level permissions block and grants only what each job actually uses, following the same pattern already used in dependency audit.yml and zizmor.yml. Most jobs only need contents read for checkout. The jobs that post a PR comment (post summary in check links.yml and check links in check markdown links.yml) get pull requests write instead. Checkout steps that do not push commits now also set persist credentials to false.

More workflows remain to audit, this covers the CI linting and doc link checking group as a first incremental step per the issue's own guidance to address this incrementally across multiple PRs.

Test plan

  • Ran zizmor locally against the changed files with the repo config, no findings
  • Ran yamlfix on the changed files, no changes needed
  • Reviewed each job's steps to confirm no push or write operation depends on the removed default permissions

github-actions Bot and others added 3 commits July 2, 2026 21:59
Co-authored-by: ZenML GmbH <info@zenml.io>
(cherry picked from commit 2de41ef)
* Updated docs to include K8s distros

* Adjusted for accuracy and clarity

* Also added to pro section
These reusable and entry point workflows relied on the default
GITHUB_TOKEN permissions, which grant broader access than they need.
Each now declares an empty workflow level permissions block and
scopes each job to only what it actually uses (contents read for
checkout, pull requests write only where a PR comment is posted).
Checkout steps that do not push commits now also set
persist credentials to false.

First batch toward auditing all workflows for zenml-io#4658
The pr labeler workflow had no permissions block, so it lost its
default write access once the repo tightened token permissions as
part of the ongoing actions audit, causing every PR to fail with
Resource not accessible by integration when the labeler tried to
add labels. Also the unpinned uses ignore entries in zizmor.yml
still pointed at old line numbers for update-templates-to-examples.yml,
so the file drifted out of sync after edits and zizmor started
flagging the intentionally unpinned template actions as real
findings, blocking CI.
The template-injection ignore entries for release.yml also pointed
at old line numbers, 169 and 170, while the actual findings are now
at 162 and 163 after earlier edits to the file. Same class of drift
as the update-templates-to-examples.yml entries fixed previously.
Verified zizmor now exits clean, 0, against the full workflow set.
GitHub always issues a read only GITHUB_TOKEN for pull_request events
triggered from a forked repository, regardless of any permissions
block declared in the workflow. The pr labeler job and the check
links comment steps were still attempting those writes on fork PRs
and dying with Resource not accessible by integration. Both now
check that the PR head repo matches the base repo before running,
so fork PRs skip the write attempt cleanly instead of failing the
whole check. Same origin repo PRs are unaffected.
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.

2 participants