Skip to content

chore(ci): set default workflow permissions to contents: read#45961

Merged
ArthurZucker merged 1 commit into
mainfrom
ci/default-workflow-permissions
May 14, 2026
Merged

chore(ci): set default workflow permissions to contents: read#45961
ArthurZucker merged 1 commit into
mainfrom
ci/default-workflow-permissions

Conversation

@XciD
Copy link
Copy Markdown
Member

@XciD XciD commented May 14, 2026

Summary

Add an explicit top-level permissions: block to every workflow that did not have one. The new default grants only contents: read, so each job's auto-generated GITHUB_TOKEN starts at the minimum needed to checkout the repo. Jobs that need more (issue/PR comments, statuses, OIDC token, packages write, etc.) already declare job-level permissions: overrides; those are preserved.

Also tightens pr-repo-consistency-bot.yml and self-comment-ci.yml from permissions: read-all to permissions: { contents: read }. read-all grants every readonly scope (issues, packages, actions, deployments, ...), which is broader than these workflows need.

Impact

  • Zizmor 1.24.1: 116 warning[excessive-permissions] -> 0 across .github/workflows/.
  • Closes the matching CodeQL actions/missing-workflow-permissions alerts that started firing after the SHA-pinning rescan.
  • Behavior unchanged: workflows that emit PR comments, update statuses, push images, etc. already had job-level grants and continue to work. This change only removes the implicit write-everything hammock for jobs that never used it.

Reviewer notes

  • The diff is large (50 files) but uniform: 3 added lines per workflow (permissions: + contents: read + blank). The two read-all replacements are 1-line edits.
  • benchmark.yml and check_tiny_models.yml had CRLF line endings on main; both committed with their original CRLF preserved.
  • The remaining zizmor warnings (secrets-inherit, artipacked, unpinned-images, dangerous-triggers) are tracked for follow-up PRs.

Add an explicit top-level `permissions:` block to every workflow that
did not have one. The new default grants only `contents: read` so that
the auto-generated `GITHUB_TOKEN` available to each job starts at the
minimum needed to checkout the repo; jobs that need more (e.g. issue/PR
comments, status updates, OIDC token, packages write) already declare
their own job-level `permissions:` overrides which are preserved.

Also tighten `pr-repo-consistency-bot.yml` and `self-comment-ci.yml`
from `permissions: read-all` to `permissions: { contents: read }`.

Zizmor 1.24.1: 116 `warning[excessive-permissions]` -> 0. Closes the
matching CodeQL `actions/missing-workflow-permissions` alerts.

Behavior: no change. Workflows that were implicitly relying on the
default `GITHUB_TOKEN` write permissions (issue comments, statuses,
deployments, ...) already had job-level overrides; this change only
removes the implicit-write hammock for jobs that did not need it.
@ArthurZucker ArthurZucker marked this pull request as ready for review May 14, 2026 06:40
@ArthurZucker ArthurZucker enabled auto-merge May 14, 2026 06:40
@ArthurZucker ArthurZucker added this pull request to the merge queue May 14, 2026
@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Merged via the queue into main with commit bc7b4cf May 14, 2026
34 checks passed
@ArthurZucker ArthurZucker deleted the ci/default-workflow-permissions branch May 14, 2026 06:51
jp1924 pushed a commit to jp1924/transformers that referenced this pull request May 18, 2026
…gface#45961)

Add an explicit top-level `permissions:` block to every workflow that
did not have one. The new default grants only `contents: read` so that
the auto-generated `GITHUB_TOKEN` available to each job starts at the
minimum needed to checkout the repo; jobs that need more (e.g. issue/PR
comments, status updates, OIDC token, packages write) already declare
their own job-level `permissions:` overrides which are preserved.

Also tighten `pr-repo-consistency-bot.yml` and `self-comment-ci.yml`
from `permissions: read-all` to `permissions: { contents: read }`.

Zizmor 1.24.1: 116 `warning[excessive-permissions]` -> 0. Closes the
matching CodeQL `actions/missing-workflow-permissions` alerts.

Behavior: no change. Workflows that were implicitly relying on the
default `GITHUB_TOKEN` write permissions (issue comments, statuses,
deployments, ...) already had job-level overrides; this change only
removes the implicit-write hammock for jobs that did not need it.
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.

3 participants