Skip to content

ci: declare GITHUB_TOKEN scope explicitly for three workflows#40520

Open
arpitjain099 wants to merge 1 commit into
microsoft:masterfrom
arpitjain099:ci/explicit-permissions
Open

ci: declare GITHUB_TOKEN scope explicitly for three workflows#40520
arpitjain099 wants to merge 1 commit into
microsoft:masterfrom
arpitjain099:ci/explicit-permissions

Conversation

@arpitjain099
Copy link
Copy Markdown

Three workflows in this repo currently leave GITHUB_TOKEN scope implicit (no top-level permissions: block), so the token inherits whatever the repository default is. This patch declares the minimum scope each workflow actually needs:

  • distributions.yml and modern-distributions.yml — both run on pull_request against distributions/** and only check out the repo + run a Python validator. contents: read is all they need.
  • winget.yml — runs on release: released and forwards *.msi asset URLs to wingetcreate using the WINGET_TOKEN secret. It does not check out the repo and does not call any GitHub API endpoint, so permissions: {} (no scopes at all) is correct here.

The change is mechanical — no job steps, no triggers, no conditions move. Files were validated with python -c "import yaml; yaml.safe_load(...)" before commit.

distributions.yml and modern-distributions.yml only check out the repo and run
python validators, so they get contents: read.

winget.yml runs on release: published and forwards a precomputed artifact URL
to wingetcreate using the WINGET_TOKEN secret (an external token). It does not
checkout the repo and does not call any GitHub API endpoint, so it gets
permissions: {} (no scopes needed).

This brings the three workflows in line with the other workflows in this repo
that already declare explicit permissions.

Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
@arpitjain099 arpitjain099 requested a review from a team as a code owner May 13, 2026 06:21
Copilot AI review requested due to automatic review settings May 13, 2026 06:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Declares explicit minimal GITHUB_TOKEN permissions in three GitHub Actions workflows to avoid inheriting repository-default token scopes, tightening CI security without changing workflow behavior.

Changes:

  • Set permissions: {} for winget.yml (no GITHUB_TOKEN scopes).
  • Set permissions: contents: read for distributions.yml and modern-distributions.yml (sufficient for actions/checkout + validation scripts).
  • Normalized YAML formatting around the on: block in distributions.yml as part of the mechanical update.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
.github/workflows/winget.yml Explicitly removes all GITHUB_TOKEN permissions for the release-driven WinGet publishing workflow.
.github/workflows/modern-distributions.yml Restricts token scope to contents: read for PR validation of distributions/**.
.github/workflows/distributions.yml Restricts token scope to contents: read for PR validation of distributions/** and cleans up YAML formatting.

@arpitjain099 arpitjain099 force-pushed the ci/explicit-permissions branch from 2f04840 to c30859a Compare May 13, 2026 17:13
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