Skip to content

ci: declare GITHUB_TOKEN scope explicitly for three workflows - #40520

Merged
OneBlue merged 2 commits into
microsoft:masterfrom
arpitjain099:ci/explicit-permissions
May 28, 2026
Merged

ci: declare GITHUB_TOKEN scope explicitly for three workflows#40520
OneBlue merged 2 commits into
microsoft:masterfrom
arpitjain099:ci/explicit-permissions

Conversation

@arpitjain099

Copy link
Copy Markdown
Contributor

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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
@arpitjain099

Copy link
Copy Markdown
Contributor Author

Hi @benhillis, gentle ping on this. PR has been open for 4 days without review. I noticed you've been on the recent-merger side of recent merges in this repo. When you have a moment, would you mind giving it a quick look? No urgency. Happy to address any feedback.

Copilot AI review requested due to automatic review settings May 26, 2026 07:24
@arpitjain099

Copy link
Copy Markdown
Contributor Author

Hey, Bringing this back to the top of the queue. Happy to fix conflicts or adjust the approach. Thanks for your time.

@OneBlue

OneBlue commented May 27, 2026

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@OneBlue
OneBlue merged commit 946f280 into microsoft:master May 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.

3 participants