Skip to content

ci: set explicit GITHUB_TOKEN permissions on generate and test - #1741

Open
biglittlebigben wants to merge 1 commit into
mainfrom
ci/workflow-permissions
Open

ci: set explicit GITHUB_TOKEN permissions on generate and test#1741
biglittlebigben wants to merge 1 commit into
mainfrom
ci/workflow-permissions

Conversation

@biglittlebigben

Copy link
Copy Markdown
Contributor

Follow-up to #1733. CodeQL flagged the equivalent workflow in psrpc#124 for relying on the default GITHUB_TOKEN permissions (actions/missing-workflow-permissions). These two workflows predate the check so nothing flagged them, but they carry the same exposure. release.yaml and slack-notifier.yaml already scope theirs.

workflow permission why
generate.yaml contents: write add-and-commit pushes the regenerated output
buildtest.yaml contents: read lint and test only read the checkout

Note generate.yaml deliberately does not take CodeQL's suggested contents: read starting point — that would break the commit step.

buildtest.yaml needs nothing beyond contents: read: the cache restore/save steps and golangci-lint-action require no additional scopes (pull-requests: read is only needed for only-new-issues, which isn't set).

After this, every workflow in the repo has an explicit block.

🤖 Generated with Claude Code

@changeset-bot

changeset-bot Bot commented Aug 25, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: ab9c8b8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

CodeQL flags workflows that rely on the default GITHUB_TOKEN
permissions. These two predate the check, so nothing flagged them, but
they carry the same exposure. release.yaml and slack-notifier.yaml
already scope theirs.

generate.yaml needs `contents: write` because add-and-commit pushes the
regenerated output - the `contents: read` CodeQL suggests as a starting
point would break it. buildtest.yaml only reads the checkout: its cache
steps need no token scope, and golangci-lint-action only wants
pull-requests: read for only-new-issues, which is not set.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

1 participant