ci: declare workflow-scope permissions on attach-release-artifacts and sonarcloud#798
Open
arpitjain099 wants to merge 1 commit into
Open
ci: declare workflow-scope permissions on attach-release-artifacts and sonarcloud#798arpitjain099 wants to merge 1 commit into
arpitjain099 wants to merge 1 commit into
Conversation
…d sonarcloud attach-release-artifacts uses `gh release upload` with GITHUB_TOKEN to attach a packaged cursor-rules zip to the published release; the release/upload-asset API call requires contents:write. sonarcloud runs SonarSource/sonarqube-scan-action against the main branch. The action only reads the repo + sends results to SonarCloud via SONAR_TOKEN. contents:read covers the actions/checkout call; no GitHub API write is needed for the scan itself. Style matches the workflow-level permissions block already in publish-library.yml, publish-s2-library.yml, publish-prod-storybook.yml, publish-s2-storybook.yml, and pr-checks.yml. Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two workflows currently leave the workflow
GITHUB_TOKENscope implicit. This patch pins each to its minimum:.github/workflows/attach-release-artifacts.yml--contents: write. The job packages a cursor-rules zip and uploads it viagh release upload --clobber, which hits the releases/assets API; that needscontents: write..github/workflows/sonarcloud.yml--contents: read. The single job checks out, runsyarn lint/yarn test, thenSonarSource/sonarqube-scan-action. SonarCloud authenticates viaSONAR_TOKEN; the workflowGITHUB_TOKENis only used for the implicit checkout.Style matches the workflow-level permissions blocks already declared by
publish-library.yml,publish-s2-library.yml,publish-prod-storybook.yml,publish-s2-storybook.yml, andpr-checks.yml(all using a mix ofid-token: write,contents: write,pull-requests: writedepending on what they actually do).Third-party action exposure that motivates pinning:
SonarSource/sonarqube-scan-action@master,actions/setup-node,actions/checkout. Explicit scope keeps a hypothetical compromise (cf.tj-actions/changed-filesCVE-2025-30066) contained.No behavioural change to either workflow.